Forum Discussion
Dax : I want to write Dax measure % increase or decrease versus pervious month
- 3 years ago
Hi Tamerj,
Thanks a lot for the help 🙂 It worked
% Automated Order EU - Previous Month =
VAR CurrentAcual = [% Automated order EU]
VAR PreviousActual =
CALCULATE (
[% Automated order EU],
ALLSELECTED ( 'SM Dim Calendar' ),
'SM Dim Calendar'[Fiscal Month Number]
= MAX ( 'SM Dim Calendar'[Fiscal Month Number] ) - 1
)
RETURN
CurrentAcual - COALESCE ( PreviousActual, CurrentAcual )
Hi SupriyaVarun
The assumption is that your date table contains a YearMonthRank column which is a squential number that increases by one every month over the years.
Actual MOM =
VAR CurrentAcual = [Actual]
VAR PreviousActual =
CALCULATE (
[Actual],
ALLSELECTED ( 'Date' ),
'Date'[YearMonthRank]
= MAX ( 'Date'[YearMonthRank] ) - 1
)
RETURN
CurrentAcual - COALESCE ( PreviousActual, CurrentAcual )Hi Tamerj,
Thanks a lot for the help 🙂 It worked
% Automated Order EU - Previous Month =
VAR CurrentAcual = [% Automated order EU]
VAR PreviousActual =
CALCULATE (
[% Automated order EU],
ALLSELECTED ( 'SM Dim Calendar' ),
'SM Dim Calendar'[Fiscal Month Number]
= MAX ( 'SM Dim Calendar'[Fiscal Month Number] ) - 1
)
RETURN
CurrentAcual - COALESCE ( PreviousActual, CurrentAcual )