Forum Discussion

MarcoUrbanic's avatar
MarcoUrbanic
Regular Visitor
7 years ago
Solved

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!

  • 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"))

    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.

1 Reply

  • v-xuding-msft's avatar
    v-xuding-msft
    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"))

    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.