I’ve created a calculation which gives me the last value on a month basis but I need a measure to show me the last value for the previous month as I need to show the delta between the two.
So I need to know how to shift Life Miles Last Value back to the previous month
I haven’t posted a PBIX as I thought this might be relatively simple fix but if you need a PBIX let me know and I’ll cobble one together.
Life Miles Last Value =
VAR _LastDateWithMiles = MAX ( Assets[Snapshot Date] )
VAR Result =
CALCULATE (
[Life Miles],
'Date'[Date] = _LastDateWithMiles
)
RETURN
Result
Since you want to evaluate the last value of the previous month. Can you please try the below provided measure?
Life Miles Last Value =
VAR _LastDateWithMiles =
LASTDATE( PREVIOUSMONTH( Assets[Snapshot Date] ) )
VAR Result =
CALCULATE ( [Life Miles] ,
'Date'[Date] = _LastDateWithMiles )
RETURN
Result
Hoping you find this useful and meets your requirements that you have been looking for.
@Harsh That’s great, much appreciated, works perfectly.
I tried a few different ways to no avail, but the simplicity of your solution is great. Your answer has been a great piece of learning, thank you. I was applying to the shift of dates incorrectly to the calculate also
Today, I came across one of the post over LinkedIn and I think you’ll find this one very helpful while evaluating or shifting the date contexts in your measures. Below is the link of the post provided for the reference.
Hoping you’ll find this post helpful for future references.