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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gustavo80
Helper III
Helper III

Conditional formatting related to row values instead of columns

Hi! I need to set background color in every row with this criteria: darkest colour to higher value IN THE ROW ( note thats this value could belong to diferent measures, kpi1, kpi2, etc), lighter colour to lowest value IN THE ROW, and a degrade between intermediate values.

I noticed that this could be with formational conditional menu on any field of my table, but this set the colours according to lowest/higher value IN THE COLUMN. I need to do this but related to ROW VALUES.

I tried with DAX expresiones, but I failed to calculate a measure "Color" ,for example , that I could use in "Formatting color based on a field". I suppose a kind of division between current value and maxium/minium values could work but I dont know how to calculate this measure 😞

Is possible to do this in PowerBI ? Thanks in advance, 

 

This is a simplified example of what I need:

 

Screen Shot 2020-05-11 at 8.14.03 PM.png

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@gustavo80 

Interesting. Can be done. Create a disconnected table for your KPI's and a KPI to Show measure like:

KPI to Show = 
    SWITCH(MAX('KPI'[KPI]),
        "kpi1",[kpi1],
        "kpi2",[kpi2],
        "kpi3",[kpi3],
        "kpi4",[kpi4]
    )

Now create a color measure like:

Measure = 
    VAR __Table =
        {
            [kpi1],
            [kpi2],
            [kpi3],
            [kpi4]
        }
RETURN
    COUNTROWS(FILTER(__Table,[Value]<=[KPI to Show]))

Create a matrix with your date in the Rows, KPI from your disconnected table in the Columns and KPI to Show in Values. Base your color coding on Measure. Example attached.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

6 REPLIES 6
Greg_Deckler
Super User
Super User

@gustavo80 

Interesting. Can be done. Create a disconnected table for your KPI's and a KPI to Show measure like:

KPI to Show = 
    SWITCH(MAX('KPI'[KPI]),
        "kpi1",[kpi1],
        "kpi2",[kpi2],
        "kpi3",[kpi3],
        "kpi4",[kpi4]
    )

Now create a color measure like:

Measure = 
    VAR __Table =
        {
            [kpi1],
            [kpi2],
            [kpi3],
            [kpi4]
        }
RETURN
    COUNTROWS(FILTER(__Table,[Value]<=[KPI to Show]))

Create a matrix with your date in the Rows, KPI from your disconnected table in the Columns and KPI to Show in Values. Base your color coding on Measure. Example attached.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks Greg! It seems to be a little tricky, but it works ok for what I need.

 

Thanks for the quick solution and for the example attached!

 

Regards,

Hey @Greg_Deckler , I'm kinda stuck in the same scenario and I have 1000s of rows... Would you happen to know how to go about it, please? Capture.PNG

@shrutiiyer - Hard to say, what are the rules for your conditional colors?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler I'm working on a table/,matrix visualization in PowerBI to display website traffic growth by month with rows set to be individual landing pages. There are quite a few pages and we'd like it to visualize the change over time with condition colour formatting of the cells. However, there is a lot of disparity between groups of pages as some are in the 10000+ range with others less than 100. But it's important to visualize the change over time for the lower traffic pages as well as the traffic is significant less in volume but much higher in conversion potential. search volume.JPG

Yeah, it's definitely a bit tricky but I'm not sure how else to do it. Disconnected table trick, comes in handy!


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors