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

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s