Forum Discussion

sudanaditya's avatar
sudanaditya
Regular Visitor
7 years ago
Solved

DAX formula for the below Sample

Hello Gurus - I am trying to create condition formating on  values with below condition

>95 then 1

between 90 to 95 then 2

<90 then 3

Any help is appreciated .

Regards

Sudan

  • Hi sudanaditya 

    You may create a measure with IF condition like below:

    Condition = 
    IF (
        SUM ( 'Sample'[data] ) > 95,
        1,
        IF (
            SUM ( 'Sample'[data] ) < 90,
            3,
            IF ( SUM ( 'Sample'[data] ) > 90 && SUM ( 'Sample'[data] ) < 95, 2 )
        )
    )
    

    Regards,

3 Replies

  • sudanaditya's avatar
    sudanaditya
    Regular Visitor

    Hello All - Need the Dax formula as I am either getting 1 or 3 when i use switch or IF not sure what I am missing .

    Regards

    Sudan

    • v-cherch-msft's avatar
      v-cherch-msft
      Microsoft Employee

      Hi sudanaditya 

      You may create a measure with IF condition like below:

      Condition = 
      IF (
          SUM ( 'Sample'[data] ) > 95,
          1,
          IF (
              SUM ( 'Sample'[data] ) < 90,
              3,
              IF ( SUM ( 'Sample'[data] ) > 90 && SUM ( 'Sample'[data] ) < 95, 2 )
          )
      )
      

      Regards,

  • Unless there is a particular reason for DAX you can use the Conditional Column feature to do it. 

     

    Edit Queries > Add Column > Conditional Column.