Forum Discussion

Bessonnizza's avatar
Bessonnizza
Helper II
6 years ago
Solved

Boolean calculations measure

Hi, all.

 

Have table with the following columns:

Date - CompanyID - Licenses

 

Have measures:

SumLicense = SUMX('Billing';'Billing'[Licenses])
SumLicensePreviousWeek = CALCULATE(SUMX('Billing';'Billing'[Licenses]);DATEADD('Calendar'[Date];-7;DAY))
Difference = SumLicense-SumLicensePreviousWeek

Need to calculate Total Difference is less than 0 and Total Difference is greater than 0 for current Year and visualize it for card or pie chart.

 

For example i can add measures for table and add filters less/greater than 0 and get calculations that i needed in string "Total".

Аnyone have ideas how i can visualize it for card or pie chart?

 

Thanks in advance.

  • parry2k's avatar
    parry2k
    6 years ago

    Bessonnizza add following two measures and use these in pie chart. hope it helps.

     

    Would appreciate Kudos 🙂 if my solution helped.

     

    Measure above zero = 
    SUMX ( 
    VALUES ( Table[CompanyId] ), 
    IF ( [Difference] > 0, [Difference] )
    )
    
    Measure below zero = 
    SUMX ( 
    VALUES ( Table[CompanyId] ), 
    IF ( [Difference] < 0, [Difference] )
    )
    
    

      

4 Replies

  • Bessonnizza you cannot change th visual of table visual to pie chart and I believe it should work. If you already tried it and then what didn't woked in pie chart, please explain.

    • Bessonnizza's avatar
      Bessonnizza
      Helper II

       Hi, parry2k

       

      I'm sorry, i'm not correctly at all. Yes, it works, but pie chart must include two values:
      1) SUM [Difference] with condition [Difference]>0
      2) |SUM [Difference]| with condition [Difference]<0

       

      Need value which circled red.

      I have troubles with measure which calculate SUM [Difference] with condition [Difference]>0 or <0. 

       

      • parry2k's avatar
        parry2k
        Super User

        Bessonnizza add following two measures and use these in pie chart. hope it helps.

         

        Would appreciate Kudos 🙂 if my solution helped.

         

        Measure above zero = 
        SUMX ( 
        VALUES ( Table[CompanyId] ), 
        IF ( [Difference] > 0, [Difference] )
        )
        
        Measure below zero = 
        SUMX ( 
        VALUES ( Table[CompanyId] ), 
        IF ( [Difference] < 0, [Difference] )
        )