Forum Discussion
matrix_user
3 years agoHelper III
Subtracting values up column databases
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) gi...
- 3 years ago
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 )
Jihwan_Kim
3 years agoSuper User
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
)