Forum Discussion
alsm
Helper III
2 years agoDisplay difference in measure by category
My data looks like
| Date | Scenario | Level | Income |
| 31/05/2023 | Base | A | 58,619 |
| 31/05/2023 | Base | D | 7,914 |
| 31/05/2023 | Base | L | 471 |
| 31/05/2023 | Down | A | 59,107 |
| 31/05/2023 | Down | D | 9,179 |
| 31/05/2023 | Down | L | 81 |
| 31/05/2023 | Up | A | 57,808 |
| 31/05/2023 | Up | D | 7,698 |
| 31/05/2023 | Up | L | 1,142 |
I am displaying line chart
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
| Date | Scenario | Level | Income |
| 31/05/2023 | Base | A | 58,619 |
| 31/05/2023 | Base | D | 7,914 |
| 31/05/2023 | Base | L | 471 |
| 31/05/2023 | Down | A | 59,107 |
| 31/05/2023 | Down | D | 9,179 |
| 31/05/2023 | Down | L | 81 |
| 31/05/2023 | Up | A | 57,808 |
| 31/05/2023 | Up | D | 7,698 |
| 31/05/2023 | Up | L | 1,142 |
| 30/06/2023 | Base | A | 61,400 |
| 30/06/2023 | Base | D | 4,721 |
| 30/06/2023 | Base | L | 620 |
| 30/06/2023 | Down | A | 61,954 |
| 30/06/2023 | Down | D | 7,279 |
| 30/06/2023 | Down | L | 146 |
| 30/06/2023 | Up | A | 60,527 |
| 30/06/2023 | Up | D | 3,278 |
| 30/06/2023 | Up | L | 1,380 |
| 31/07/2023 | Base | A | 60,247 |
| 31/07/2023 | Base | D | 6,636 |
| 31/07/2023 | Base | L | 573 |
| 31/07/2023 | Down | A | 60,700 |
| 31/07/2023 | Down | D | 9,504 |
| 31/07/2023 | Down | L | 116 |
| 31/07/2023 | Up | A | 59,479 |
| 31/07/2023 | Up | D | 4,871 |
| 31/07/2023 | Up | L | 1,320 |
| 31/08/2023 | Base | A | 60,755 |
| 31/08/2023 | Base | D | 6,217 |
| 31/08/2023 | Base | L | 535 |
| 31/08/2023 | Down | A | 61,205 |
| 31/08/2023 | Down | D | 8,940 |
| 31/08/2023 | Down | L | 91 |
| 31/08/2023 | Up | A | 59,982 |
| 31/08/2023 | Up | D | 4,586 |
| 31/08/2023 | Up | L | 1,270 |
| 30/09/2023 | Base | A | 64,755 |
| 30/09/2023 | Base | D | 7,389 |
| 30/09/2023 | Base | L | 593 |
| 30/09/2023 | Down | A | 65,222 |
| 30/09/2023 | Down | D | 10,356 |
| 30/09/2023 | Down | L | 113 |
| 30/09/2023 | Up | A | 63,967 |
| 30/09/2023 | Up | D | 5,539 |
| 30/09/2023 | Up | L | 1,372 |
hello it seems that you are trying to sum a measure, you are using the wrong syntax pelase try sumx instead of sum
Hi, alsm
tyr belowresult = Calculate(Sumx(data2,[output]), data2[Scenario]="Base") - Calculate(Sumx(data2,[output]), data2[Scenario]="Down")
5 Replies
- eliasayyy
Memorable Member
hello it seems that you are trying to sum a measure, you are using the wrong syntax pelase try sumx instead of sum