Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
)
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
11 | |
9 | |
6 |