Forum Discussion

SoporteBI's avatar
SoporteBI
New Member
5 years ago
Solved

How to sum this measure?

I have a measure called 'ALERT': 

 

Alert = IF([Group1] > [Group2],0,
IF([Group1] = [Group2],0,
IF([Group1] < [Group2],1
)))
 
Can I sum the ones? How can i sum the values with '1'?
 
I put this measure in a bar chart but there is no calculation, I can't.
  • Hi, 

    According to your description, I can roughly understand your requirement, you want to get the sum of the [Alert] to display it in a bar chart, right? I think you can try my steps:

    This is my test data:

     

    You can create a calculated column

    Alert =
    
    IF([Group1]>=[Group2],0,1)

    Then you can create a measure:

    Measure =
    
    SUM('Table'[Alert])

     

    And you can go to create a bar chart to place it like this to get what you want.

     

    You can download my test pbix file below

    Thank you very much!

     

    Best Regards,

    Community Support Team _Robert Qin

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

2 Replies

  • @@SoporteB , Try measure like

     

    sumx(Table, Switch(true() ,

    [Group1] > [Group2],0,
    [Group1] = [Group2],0,
    [Group1] < [Group2],1
    ) )

     

  • v-robertq-msft's avatar
    v-robertq-msft
    Icon for Community Support rankCommunity Support

    Hi, 

    According to your description, I can roughly understand your requirement, you want to get the sum of the [Alert] to display it in a bar chart, right? I think you can try my steps:

    This is my test data:

     

    You can create a calculated column

    Alert =
    
    IF([Group1]>=[Group2],0,1)

    Then you can create a measure:

    Measure =
    
    SUM('Table'[Alert])

     

    And you can go to create a bar chart to place it like this to get what you want.

     

    You can download my test pbix file below

    Thank you very much!

     

    Best Regards,

    Community Support Team _Robert Qin

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