Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
alsm
Helper III
Helper III

Display difference in measure by category

My data looks like

DateScenarioLevel Income 
31/05/2023BaseA             58,619
31/05/2023BaseD                7,914
31/05/2023BaseL                   471
31/05/2023DownA             59,107
31/05/2023DownD                9,179
31/05/2023DownL                      81
31/05/2023UpA             57,808
31/05/2023UpD                7,698
31/05/2023UpL                1,142

 

I am displaying line chart

alsm_0-1699443285454.png

 

where measure Total is combination of two other measures

 

 

 

Total = [A_D] + [L_D]

 

 

 

where

 

 

 

A_D = CALCULATE(SUM(data2[Income]),data2[Level]="A" || data2[Level]="D")

L_D = CALCULATE(SUM(data2[Income]),data2[Level]="L" || data2[Level]="D")

 

 

 

 

In Legend I have scenario (which creates 3 lines)

Base, Down, Up

and I see values of 'Total' in tooltip

I additionally want to show 

Base - Down in tooltip

 

I cannot create a measure that works like

 

 

 

Base-Down = Calculate(Sum([Total]), data2[Scenario]="Base") - Calculate(Sum([Total]), data2[Scenario]="Down")

 

 

 

i.e. Sum([Total]) ie. sum of measure is not allowed. 

Any ideas how to implement this? 

 

full data series in chart

DateScenarioLevel Income 
31/05/2023BaseA             58,619
31/05/2023BaseD                7,914
31/05/2023BaseL                   471
31/05/2023DownA             59,107
31/05/2023DownD                9,179
31/05/2023DownL                      81
31/05/2023UpA             57,808
31/05/2023UpD                7,698
31/05/2023UpL                1,142
30/06/2023BaseA             61,400
30/06/2023BaseD                4,721
30/06/2023BaseL                   620
30/06/2023DownA             61,954
30/06/2023DownD                7,279
30/06/2023DownL                   146
30/06/2023UpA             60,527
30/06/2023UpD                3,278
30/06/2023UpL                1,380
31/07/2023BaseA             60,247
31/07/2023BaseD                6,636
31/07/2023BaseL                   573
31/07/2023DownA             60,700
31/07/2023DownD                9,504
31/07/2023DownL                   116
31/07/2023UpA             59,479
31/07/2023UpD                4,871
31/07/2023UpL                1,320
31/08/2023BaseA             60,755
31/08/2023BaseD                6,217
31/08/2023BaseL                   535
31/08/2023DownA             61,205
31/08/2023DownD                8,940
31/08/2023DownL                      91
31/08/2023UpA             59,982
31/08/2023UpD                4,586
31/08/2023UpL                1,270
30/09/2023BaseA             64,755
30/09/2023BaseD                7,389
30/09/2023BaseL                   593
30/09/2023DownA             65,222
30/09/2023DownD             10,356
30/09/2023DownL                   113
30/09/2023UpA             63,967
30/09/2023UpD                5,539
30/09/2023UpL                1,372
2 ACCEPTED SOLUTIONS
eliasayyy
Super User
Super User

hello it seems that you are trying to sum a measure, you are using the wrong syntax pelase try sumx instead of sum

View solution in original post

Dangar332
Super User
Super User

Hi, @alsm 

tyr below

result =
  Calculate(Sumx(data2,[output]), data2[Scenario]="Base") - Calculate(Sumx(data2,[output]), 
  data2[Scenario]="Down")

View solution in original post

5 REPLIES 5
Dangar332
Super User
Super User

Hi, @alsm 

tyr below

result =
  Calculate(Sumx(data2,[output]), data2[Scenario]="Base") - Calculate(Sumx(data2,[output]), 
  data2[Scenario]="Down")

Hi @Dangar332 ,

cosmetic edit to your solution

result =
  Calculate(Sumx(data2,[Total]), data2[Scenario]="Base") - Calculate(Sumx(data2,[Total]), 
  data2[Scenario]="Down")

the measure I want to add is Total (and not output)

 

Thank you for your reply

Hi, @alsm 

no problem but your measure [total]  is saved by me as a  name [output] so i mention output as a measure name

eliasayyy
Super User
Super User

hello it seems that you are trying to sum a measure, you are using the wrong syntax pelase try sumx instead of sum

Hi @eliasayyy 

Thank you for your reply.

learning: "to add measures with filter one needs to use sumx and for adding columns sum would suffice"

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.