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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello,
What DAX measure (or column) would be required if I wanted to count the difference in values within a column of a fact table - per year?
Below the subtract of 8 (2021) from 5 (2010) gives me 3.
Kudos to who can help.
Thank!
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
It is for creating a measure.
Diff: =
VAR _previousvalue =
CALCULATE (
[Total coffees:],
OFFSET ( -1, ALL ( Data[Year] ), ORDERBY ( Data[Year], ASC ) )
)
RETURN
IF (
NOT ISBLANK ( _previousvalue ) && HASONEVALUE ( Data[Year] ),
[Total coffees:] - _previousvalue
)
Fantastic!
Hi,
Please check the below picture and the attached pbix file.
It is for creating a measure.
Diff: =
VAR _previousvalue =
CALCULATE (
[Total coffees:],
OFFSET ( -1, ALL ( Data[Year] ), ORDERBY ( Data[Year], ASC ) )
)
RETURN
IF (
NOT ISBLANK ( _previousvalue ) && HASONEVALUE ( Data[Year] ),
[Total coffees:] - _previousvalue
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 5 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 11 | |
| 9 | |
| 6 | |
| 6 |