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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
third_hicana
Helper IV
Helper IV

Conditional Formatting- Background color based on comparing the values of multiple columns

Hi. I just want to ask for help on how to create a measure to format the background color based on the lowest to the highest value of multiple columns.

 

third_hicana_1-1707216737922.png

 

Thank you for your help

4 REPLIES 4
third_hicana
Helper IV
Helper IV

Hi @v-weiyan1-msft 

Is there anyway to do it on a table instead of a matrix? columns that I need to include aside from FTEs. Thank you. 

v-weiyan1-msft
Community Support
Community Support

Hi @third_hicana ,

 

I am not sure if I understood your question correctly.
Based on your description and my understanding, I used the following data sample.

vweiyan1msft_0-1707303470560.png

Please refer to the following steps:
1.Please try code as below to Create a Calcualted table.

Table 2 = DATATABLE(
                    "ColumnName",STRING,
                    "Order",INTEGER,
                    {
                        {"Est. FTE Q1",1},
                        {"Est. FTE Q2",2},
                        {"Est. FTE Q3",3},
                        {"Est. FTE Q4",4},
                        {"Est. FTE for Initiative Duration",5}
                    }
                )

vweiyan1msft_1-1707303560697.png

2. Use the following code to create a Measure.

Measure = 
VAR Q1 = SELECTEDVALUE('Table'[Est. FTE Q1])
VAR Q2 = SELECTEDVALUE('Table'[Est. FTE Q2])
VAR Q3 = SELECTEDVALUE('Table'[Est. FTE Q3])
VAR Q4 = SELECTEDVALUE('Table'[Est. FTE Q4])
VAR Initiative_Duration = SELECTEDVALUE('Table'[Est. FTE for Initiative Duration])
RETURN
SWITCH(
    MAX('Table 2'[ColumnName]),
    "Est. FTE Q1",Q1,
    "Est. FTE Q2",Q2,
    "Est. FTE Q3",Q3,
    "Est. FTE Q4",Q4,
    "Est. FTE for Initiative Duration",Initiative_Duration
)

3.The fields in the visual object are as follows, right-click "Measure" and select "Conditional Formatting". Then do the following.

vweiyan1msft_2-1707303598845.png

vweiyan1msft_3-1707303653319.png

Result is as below.

vweiyan1msft_4-1707303668711.png

Please correct me if I misunderstood your needs.

 

Best Regards,
Yulia Yan

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Hi @lbendlin  Here's sample data. Thanks

 

BOP ID    BOP Title            Area           Department Code    Q1         Q2         Q3         Q4         Entire duration

B003Project 1Operations10.330.70.671 
B003Project 1Operations20.0720.27  
B003Project 1Operations3    3
B003Project 1Operations4    1
B003Project 1Operations51    
B003Project 1Operations6  0.7  
B003Project 1Operations7 1 0.33 
B003Project 1Operations80.52.5   
B003Project 1Operations9  0.25  
B003Project 1Operations101    
B003Project 1Operations11    1
B003Project 1Operations12    2
B003Project 1Operations13    2.5
B003Project 1Operations14    3.2
B003Project 1Operations15 1   
B003Project 1Operations16  0.5  

 

third_hicana_0-1707275230268.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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