Power BI: How to format a specific cell or row in a table or matrix?

This week, I got an interesting question about Power BI: “Can I format a specific cell or row in a table or matrix?”

My answer was yes and I thought it could be a great blog.

Let’s say, you need to format the Sales Amount for all countries as a whole number, except for Australia.

Note: The sample data above is only to show how to format a specific cell or row in a table or matrix.

See below two ways you can do it.

1st Option:

Step 1 – Create a calculated column as:

Format =
IF ( Sales[Country] = "Australia", "####.00", "###" )

Step 2 – Create a measure as below:

Total Sales =
FORMAT ( SUM ( Sales[SalesTax] ), MAX ( Sales[Format] ) )

2nd Option:

Create a measure as below:

Total Sales =
IF (
    MAX ( Sales[Country] ) = "Australia",
    FORMAT ( SUM ( Sales[SalesTax] ), "####.00" ),
    FORMAT ( SUM ( Sales[SalesTax] ), "###" )
)
13.08.19_Image1

You can use the same example above to apply different formats, such as decimal place, percentage and others. See more information on https://docs.microsoft.com/en-us/dax/format-function-dax

Hope it helps!

Regards,

Sabrina

2 thoughts on “Power BI: How to format a specific cell or row in a table or matrix?

  1. How do I format cells in Power Query when I am trying to validate a specific number of cells. The cells can be one of either three ways. They can be formatted in any random numbers with 2 dashes in this specific format (123-1234-12345). They can be formatted in any random 3 letters followed by 5 numbers like so (ABC12345). And the last way can be if it contains the word “Case” but I know how to do that. If the cells do not contain either of these three formats then it is Invalid.

Leave a Reply