Search code examples
powerbipowerbi-desktoppowerbi-embedded

Returning sum of the positive values and sum of negative values in the margin column in this visual into cards


I have this visual in power bi dashboard enter image description here

I want to display the sum of all the positive values in the Margin column on the Card and the negative values in the Margin Column on another Card. First Card is 185.64 and the second card is -375.39


Solution

  • Create these 2 measures and put them on card visuals:

    Pos Margin = 
    CALCULATE(
        SUM('Table'[Margin ]),
        'Table'[Margin ] >= 0
    )
    
    Neg Margin = 
    CALCULATE(
        SUM('Table'[Margin ]),
        'Table'[Margin ] < 0
    )