Forum Discussion
GillyGils
4 years agoFrequent Visitor
LAG Conversion from MDX to DAX
Hi All, I've the following MDX formula i'm trying to convert to DAX: ([Time Dimension].[Date].CurrentMember.lag(1), [Measures].[Total Available]) I've been trying to adjust the code below s...
- Anonymous4 years ago
Hi GillyGils ,
If there are only 'End of Month Dates' in your fact table. Please have a try.
Create a measure.
Measure1 = VAR _date = MAX ( 'Table'[date] ) VAR _pre_date = EOMONTH ( _date,-1) VAR _value = CALCULATE ( [total available], FILTER ( ALL ( 'Table'), 'Table'[date] = _pre_date ) ) RETURN _valueBest Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
4 years agoNot applicable
Hi GillyGils ,
If there are only 'End of Month Dates' in your fact table. Please have a try.
Create a measure.
Measure1 =
VAR _date =
MAX ( 'Table'[date] )
VAR _pre_date =
EOMONTH ( _date,-1)
VAR _value =
CALCULATE (
[total available],
FILTER ( ALL ( 'Table'), 'Table'[date] = _pre_date )
)
RETURN
_value
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
GillyGils
4 years agoFrequent Visitor
Thank you Polly. This works perfectly.
Still getting a hang of the DAX syntax and this is helping me understand it more.
Thank you.