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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
powerbi2srm
Resolver II
Resolver II

Conditional formatting row by row

I've created the following measure:

bank_sales_amount =
CALCULATE(

      sum(sale_order[sales_amount]),

      dim_activity_area[name] = "banks"

)

 

I've drag this measure to a table visualization. This visualization have geography (countries) as columns and months as rows.

 

I want to create a conditional color format to returns what are the best months for each row (geography).  For example, with this table I want to know through the color if april was a good month in Spain or if september was a good month in France

 

thank you!!

1 ACCEPTED SOLUTION

There is a similar solution here (I do recommend to read every replies):
Re: Row by row Conditional Formatting on a Matrix - Microsoft Fabric Community

View solution in original post

5 REPLIES 5
MFelix
Super User
Super User

Hi @powerbi2srm ,

 

For this you need to add an additional measure that makes your calculation identify the best month should be similar to this:

 

Colour coding =
VAR temptable =
    CALCULATETABLE (
        SUMMARIZE (
            sales_order,
            geography[countries],
            'Calendar'[Month],
            'Calendar'[Year],
            "_banksalesamount", [bank_sales_amount]
        ),
        ALLSELECTED ( 'Calendar' )
    )
RETURN
    IF ( [bank_sales_amount] = MAXX ( temptable, [_bank_sales_amount] ), "#000000" )

 

 

Replace the #000000 by the colour coding you want then use this measure has your condittional formatting.

 

This formula may need adjustment based on your model.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



That code doesn't run because calendar, sale_order and dim_geography are different tables

How are the tables related?

 

Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



This case that I'm looking for (there a are a pbix in replies). However, when I use that code and I filter by more than one year (in a slicer) I don't have the result that I expect: the code doesn't work properly.

https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Row-by-row-Conditional-Formatting-on...

There is a similar solution here (I do recommend to read every replies):
Re: Row by row Conditional Formatting on a Matrix - Microsoft Fabric Community

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.