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
MarcoUrbanic
Regular Visitor

Determine Overall Risk by Date

Not sure the best way to do this in Power BI, and if I should do it using DAX or M.  I have a table with a Date Column, items, and risk for each item.  What I want to do is set an overall risk for the date using the following rules in order:

 

If any Item is RED, the Overall Risk = RED

If any Item is YELLOW (and there are no RED items), the Overall Risk = YELLOW

If all Items are GREEN, the Overall Risk = GREEN

 

DateItem IDRiskOverall Risk
7/20/2019123GreenRed
7/20/2019124Red
7/20/2019125Yellow
7/21/2019126GreenYellow
7/21/2019127Green
7/21/2019128Yellow
7/22/2019129GreenGreen
7/22/2019130Green
7/22/2019131Green

 

Thanks in advance for the suggestions!

1 ACCEPTED SOLUTION
v-xuding-msft
Community Support
Community Support

Hi @MarcoUrbanic ,

I created a measure you can have a try.

Measure = 
var a = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Risk] = "Red"))
var b = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Risk] = "Yellow"))
return
IF(NOT(ISBLANK(a)),"Red",IF(NOT(ISBLANK(b)),"Yellow","Green"))

1.PNG

Best Regards,

Xue Ding

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

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

View solution in original post

1 REPLY 1
v-xuding-msft
Community Support
Community Support

Hi @MarcoUrbanic ,

I created a measure you can have a try.

Measure = 
var a = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Risk] = "Red"))
var b = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Risk] = "Yellow"))
return
IF(NOT(ISBLANK(a)),"Red",IF(NOT(ISBLANK(b)),"Yellow","Green"))

1.PNG

Best Regards,

Xue Ding

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

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

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.