Forum Discussion

kris1989's avatar
kris1989
Regular Visitor
9 years ago
Solved

If statement or something that will help!

Hi in need of some assistance.

 

I need a code (first thing that comes to mind is an if statement) for the following:

IF total expenditure = $5000000 and below "low risk", IF total expenditure = $5000001 - $10000000, "Medium Risk", IF total expenditure = $10000001+, "High Risk"

 

The Power Bi visualisation being used is a card and I need it linked to another card that displays the total expenditure in a report.

 

Thanks!!

3 Replies

  • Vvelarde's avatar
    Vvelarde
    Community Champion

    kris1989

     

    Hi, Create a Measure

     

     

    Risk_State =
    IF (
        SUM ( 'TableName'[Expenditure] ) < 5000000,
        "low risk",
        IF (
            SUM ( 'TableName'[Expenditure] ) < 10000000,
            "Medium Risk",
            "High Risk"
        )
    )
    • kris1989's avatar
      kris1989
      Regular Visitor

      Vvelarde

       

      G'day mate,

       

      That worked but I gave you the wrong instructions my apologies. Here is how i'd like my report to work:

      - I have two page slicers, one for the financial year change and the other for "On Contract Spend" and "Off Contract Spend".

      - I have the following cards:

      Card 1 Total Spend (column is expenditure)

      Card 2 Spend Off Contract (column is expenditure with an additional filter of Off and On Contract column)

      Card 3 Risk Rating Low $5mil and below, Med $10mil to $5mil and High $10mil+. I would like this to be linked somehow just to card 2 if possible.

       

      Would even be cooler if I could change colours ie low risk is green, med risk is orange and high is red.

       

      Thanks for your help!!