Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
cn4422
Helper IV
Helper IV

Matrix - conditional formatting single row

Hello,

 

I have a matrix table with several columns. I only want to format a single column (or maybe two).

I have two values, "count (=Anzahl) and "%" - and I only want to format the "%" of a single "country column".

 

Any idea about that?

 

Here's a picture that maybe describes better what I want to achieve.

 

Matrix conditional formatting.png

 

Many thanks in advance! 🙂

 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

hi @cn4422 

How do you identify a single country column? What makes one a single country? Or do you mean only Deutschland is to be formatted? If so, create the measures that return the values just for that specific country and apply the conditional formatting to those measures. Example:

Anzahl - Deutschland =
CALCULATE ( [Anzahl], KEEPFILTERS ( 'table'[Country] = "Deutschland" ) )

danextian_0-1733824020057.png

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

9 REPLIES 9
Lavdeepsharma
Regular Visitor

@cn4422 

If you want to apply conditional formatting to a specific country in a matrix, here's how you can do it:

I created a measure to apply the conditional formatting. For example, if I want to format only the data for "Australia," the measure looks like this:

Australia % =IF(AND(ISINSCOPE('Global-Superstore'[Country]),MAX('Global-Superstore'[Country]) ="Australia"),[Discount %],0)

After creating the measure, I applied it as the conditional formatting rule for the Discount column. This ensures that the formatting is only applied to the rows corresponding to "Australia."

I tested this approach with sample data, and it worked perfectly. You can adapt this logic for other countries by simply changing "Australia" to the desired country's name in the measure.

Let me know if you have any questions!

 

Lavdeepsharma_1-1733826891077.png

Lavdeepsharma_2-1733828581382.png



Thanks
Lavdeep Sharma

 

@Lavdeepsharma  Many thanks for your reply - I will also try out your approach! 🙂

 

Does hist work with format style "gradient" as well for you or just for "rules"?

 

danextian
Super User
Super User

hi @cn4422 

How do you identify a single country column? What makes one a single country? Or do you mean only Deutschland is to be formatted? If so, create the measures that return the values just for that specific country and apply the conditional formatting to those measures. Example:

Anzahl - Deutschland =
CALCULATE ( [Anzahl], KEEPFILTERS ( 'table'[Country] = "Deutschland" ) )

danextian_0-1733824020057.png

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

@danextian Thx for your reply!

 

Exactly, I do have the country column 'lead'[Country] with all the countries in it.

 

The selection with the measure for country worked!

When I put "Rules" as format style it's fine. However, when I put "gradient" as format style, it's formatting all countries again...

 

Do you know why this would happen?

 

 

Gradient.png

The measure returns blank for all other countries. So if you treat as zero then formatting will be applied to those blanks values if using gradient. Use dont format.

danextian_0-1733830628444.png

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.


@danextian wrote:

The measure returns blank for all other countries. So if you treat as zero then formatting will be applied to those blanks values if using gradient. Use dont format.


@danextian ah, that does the trick, thank you very much! 👍

 

Do you per chance also know if it is possible to format each column based based on itself?

So that the "gradient" does not inlcude the data of the whole matrix as reference, as on this screenshot:

 

 

not like this.png

 

 

.... but rather each column as its own entity.

 

Format based on column.png

You mean to format based on the max value of each column? You can rank row categories within that column.  Example.

Rank per Geo = 
RANKX ( ALL ( Geo ), [Total Revenue],, DESC, DENSE )

danextian_0-1733833067934.png

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.


@danextian wrote:

You mean to format based on the max value of each column?

Yes, that's exactly what I meant!

 

So you suggest to include a ranking for each column and then use the ranking as a reference for the formatting?

 

Yup. Or you can use percentages instead

DIVIDE ( [total revenue], CALCULATE ( [total revenue], ALL ( geo[geo] ) ) )

 

With rank, you'll get just the number of distinct values to based formatting on. With percentage, the gradient will be based on the min and max percentage value across the whole matrix.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.