Forum Discussion
rbustamante
Helper I
5 years agoCalculate difference between columns in matrix visual
I have the following matrix visual: I need two things when the user clicks on the "Date slicer": 1) dynamically calculate the difference between the ammount of two dates. Ammount of 31/12/202...
- 5 years ago
Hi rbustamante ,
Based on the data you provided here:
mDifference = VAR _CurrentDate = SELECTEDVALUE ( 'Products (2)'[Date]) VAR _PreviousDate = CALCULATE ( MAX ( 'Products (2)'[Date] ), ALLSELECTED ( 'Products (2)'[Date] ), KEEPFILTERS ( 'Products (2)'[Date] < _CurrentDate ) ) VAR _ThisMonth = CALCULATE ( SUM ( 'Products (2)'[Amount] ) ) VAR _PreviousMonth = CALCULATE ( SUM ( 'Products (2)'[Amount] ), 'Products (2)'[Date] = _PreviousDate ) RETURN _ThisMonth - _PreviousMonthRegards,
Payeras_BI
Solution Sage
5 years agoHi rbustamante ,
Based on the data you provided here:
mDifference =
VAR _CurrentDate =
SELECTEDVALUE ( 'Products (2)'[Date])
VAR _PreviousDate =
CALCULATE (
MAX ( 'Products (2)'[Date] ),
ALLSELECTED ( 'Products (2)'[Date] ),
KEEPFILTERS ( 'Products (2)'[Date] < _CurrentDate )
)
VAR _ThisMonth =
CALCULATE ( SUM ( 'Products (2)'[Amount] ) )
VAR _PreviousMonth =
CALCULATE (
SUM ( 'Products (2)'[Amount] ),
'Products (2)'[Date] = _PreviousDate
)
RETURN
_ThisMonth - _PreviousMonth
Regards,