Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello
I have the table below:
What I am trying to achieve is a formula where I can get all the requirements below and return colors:
RED
AMBER
GREEN
No countries under Imp
Criteria:
Unscheduled % up to 10% is GREEN/, >10% is AMBER and >25% RED
HNS % up to 10% is GREEN/, >10% is AMBER and >25% RED
Amber-Red up to 15% is GREEN, >15% is AMBER , >20% RED
And if countries_UI is blank, then No countries under Imp
ANy help is welcome
Thanks
Solved! Go to Solution.
I thought Countries_UI was not a measure. But, it is also a measure then you can just replace that line with this line:
Best Regards,
Muhammad Yousaf
If this post helps, please consider "Accept it as the solution" to help the other members find it more quickly.
Hi @romovaro
You can use this measure to get your desired output:
Color_Status =
VAR UnscheduledStatus =
SWITCH(
TRUE(),
[Unscheduled%] <= 0.10, "Green",
[Unscheduled%] > 0.10 && [Unscheduled%] <= 0.25, "Amber",
[Unscheduled%] > 0.25, "Red"
)
VAR HNSStatus =
SWITCH(
TRUE(),
[HNS%] <= 0.10, "Green",
[HNS%] > 0.10 && [HNS%] <= 0.25, "Amber",
[HNS%] > 0.25, "Red"
)
VAR AmberRedStatus =
SWITCH(
TRUE(),
[Amber-Red] <= 0.15, "Green",
[Amber-Red] > 0.15 && [Amber-Red] <= 0.20, "Amber",
[Amber-Red] > 0.20, "Red"
)
VAR FinalColor =
IF(
ISBLANK(SELECTEDVALUE('Table'[Countries_UI])),
"No countries under Imp",
IF(
UnscheduledStatus = "Red" || HNSStatus = "Red" || AmberRedStatus = "Red", "Red",
IF(
UnscheduledStatus = "Amber" || HNSStatus = "Amber" || AmberRedStatus = "Amber", "Amber",
"Green"
)
)
)
RETURN FinalColor
Output:
Best Regards,
Muhammad Yousaf
If this post helps, then please consider "Accept it as the solution" to help the other members find it more quickly.
Thanks. Looks good. I am having an issue with one of the measures:
Tried using selectedmeasure but not working.
I also created a column showing 0, 1 and tried to adapt to your formula but again...the last part is showing isses.
I thought Countries_UI was not a measure. But, it is also a measure then you can just replace that line with this line:
Best Regards,
Muhammad Yousaf
If this post helps, please consider "Accept it as the solution" to help the other members find it more quickly.
@romovaro Were you looking for the word "Green", or formatting the actual cell with a green background? Please be specific about what you desire. You showed us nice input data. Can you show us sample desired results?
Proud to be a Super User! | |
Hello @romovaro
That is fine. The Conditional Formatting logic is applied at the aggregation level (either a numeric field that is aggregated in the visual, or a measure) of the visual:
Proud to be a Super User! | |
This sounds like a simple job for Conditional Formatting (Right-click on a field in the visual, and select Conditional Formatting. You get these options:
Proud to be a Super User! | |
hi Todd
Thanks for your answer. THe thing is that all the fields are measure.
data source is showing multiples rows for every customer and the table is summarizing all the data in one row x customer.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
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 |
|---|---|
| 48 | |
| 45 | |
| 41 | |
| 20 | |
| 18 |
| User | Count |
|---|---|
| 69 | |
| 64 | |
| 32 | |
| 31 | |
| 27 |