Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
hello,
i have a table and i wante te calculate the difference between tow date
C20-21 = 2020
C21-22 = 2021
Solved! Go to Solution.
Hi, @Kadrimedquali
I have simply simulated some data that I hope fits your situation, and you can try the following methods.
Measure =
IF (
HASONEVALUE ( 'Table'[Year] ),
SUM ( 'Table'[Value] ),
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALL ( 'Table' ),
[Year] = 2021
&& [Category] = SELECTEDVALUE ( 'Table'[Category] )
)
)
- CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALL ( 'Table' ),
[Year] = 2020
&& [Category] = SELECTEDVALUE ( 'Table'[Category] )
)
)
)
Change the name of the column Total to Difference. The results are shown in the figure.
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Kadrimedquali
I have simply simulated some data that I hope fits your situation, and you can try the following methods.
Measure =
IF (
HASONEVALUE ( 'Table'[Year] ),
SUM ( 'Table'[Value] ),
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALL ( 'Table' ),
[Year] = 2021
&& [Category] = SELECTEDVALUE ( 'Table'[Category] )
)
)
- CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALL ( 'Table' ),
[Year] = 2020
&& [Category] = SELECTEDVALUE ( 'Table'[Category] )
)
)
)
Change the name of the column Total to Difference. The results are shown in the figure.
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
In this you can just use a measure. The DAX would look like this.
Difference = SUM('Table'[C20-21]) - SUM('Table'[C21-22])
Then you would just put this measure into your values for your matrix. (Or columns for a table).
i need your help
thanks
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 62 | |
| 50 | |
| 41 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 124 | |
| 109 | |
| 47 | |
| 28 | |
| 27 |