Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
I have a simple table visual that I need to apply conditional formatting to a measure and I have been searching all day and trying Copilot and have gotten no where.
This is an example of the table visual.
| Priority | Actual Hours | Percentage of Hours |
| P1 | 15 | 10.7% |
| P2 | 8 | 5.7% |
| P3 | 117 | 83.6% |
| Total | 140 | 100.0% |
My data cloumns are 'KPI'[Actual Hours], 'KPI'[Priority] with a measure to calculate the Percentage of Hours.
Solved! Go to Solution.
@dawaro add a new measure for color and then use this in the conditional formatting using field value:
Color =
VAR __SelectedPriority - SELECTEDVALUE ( 'KPI'[Priority] )
VAR __SelectedPercent = [Percentage of Hours]
VAR __KPIColor = "Red" //of add hex code
RETURN
//I'm using switch for better readability and easy maintenance, you can always IF
SWITCH (
TRUE (),
__SelectedPriority = "P1" && __SelectedPercent > 0.05, __KPIColor,
__SelectedPriority = "P2" && __SelectedPercent > 0.15, __KPIColor,
__SelectedPriority = "P3" && __SelectedPercent < 0.80, __KPIColor
)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hello Dawaro,
I tried you can check the attched screenshot.
I created a measure based on the condition based on condictinal formatting Background color based on rules and selected color measure if it is =1 then red else default color
Thanks,
Pankaj
If this solution helps, please accept it and give a kudos, it would be greatly appreciated.
Hi @dawaro ,
Thank you @parry2k and @Deku for the prompt response!
As @parry2k suggested ,the query help you to get the expected output.I tried this solution, and it works great!
Please refer the screenshot :
Hope this helps,If so please mark it as "Accept as solution" .
If you need any further assistance, feel free to reach out.
Thank you for being a valued member of the Microsoft Fabric Community Forum!
Regards,
Pallavi.
@dawaro add a new measure for color and then use this in the conditional formatting using field value:
Color =
VAR __SelectedPriority - SELECTEDVALUE ( 'KPI'[Priority] )
VAR __SelectedPercent = [Percentage of Hours]
VAR __KPIColor = "Red" //of add hex code
RETURN
//I'm using switch for better readability and easy maintenance, you can always IF
SWITCH (
TRUE (),
__SelectedPriority = "P1" && __SelectedPercent > 0.05, __KPIColor,
__SelectedPriority = "P2" && __SelectedPercent > 0.15, __KPIColor,
__SelectedPriority = "P3" && __SelectedPercent < 0.80, __KPIColor
)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
var Priority = SELECTEDVALUE( 'KPI'[Priority] )
return
IF(
( Priority = "P1" && [Percentage of Hours] > 0.05) ||
( Priority = "P2" && [Percentage of Hours] > 0.15) ||
( Priority = "P3" && [Percentage of Hours] < 0.8),
"#FF0000"
)
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 47 | |
| 35 | |
| 28 | |
| 17 | |
| 16 |
| User | Count |
|---|---|
| 59 | |
| 58 | |
| 40 | |
| 22 | |
| 20 |