Forum Discussion
InsightSeeker
Helper III
2 years agoModification of DAX for Aging Calculation Based on Selected Month
I have created the following DAX to calculate the aging as of TODAY. Now, I need to modify this DAX to calculate the aging as of the Selected Month (Last Day of the month). How can I accomplish this?...
jdbuchanan71
Super User
2 years agoYou can't do it as a calculated column because those are only updated when the model is refreshed, not when a user makes a selection on a slicer. You can also simplyfy your SWITCH a bit by starting from the top.
Aging Measure =
VAR _EndDate = MAX('Calendar Ultimate'[Date])
VAR _Due_Date = SELECTEDVALUE(Due_Date[Due_Date])
var _datediff = DATEDIFF(_Due_Date, _EndDate,MONTH)
RETURN SWITCH(TRUE(),
_datediff >12,"Above 12 Month",
_datediff >= 10, "10-12 Month",
_datediff >= 7,"7-9 Month",
_datediff >= 4,"4-6 Month",
_datediff = 3,"3 Month",
_datediff = 2,"2 Month",
_datediff = 1,"1 Month",
_datediff = 0,"Current",
_datediff < 0, BLANK(),
"0")
- InsightSeeker2 years ago
Helper III
Hi jdbuchanan71 - When i try to use the same measure in my data it doesn't work.
Also, I have slightly changed my data and here is the updated file.