Forum Discussion
Age Calculation in DAX Incorrect for Previous Months/Years
- 1 year ago
Hiiii nmhung49
Age_Week =
VAR SelectedDate = MAX('Date'[Date]) -- Get the latest date in the selected time period
VAR StartDate = SELECTEDVALUE('YourTable'[Start_Date]) -- Replace with your actual date column
VAR AgeInDays = DATEDIFF(StartDate, SelectedDate, DAY)
VAR AgeInWeeks = DIVIDE(AgeInDays, 7)RETURN AgeInWeeks
If this helps, I would appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!
Hiiii nmhung49
Age_Week =
VAR SelectedDate = MAX('Date'[Date]) -- Get the latest date in the selected time period
VAR StartDate = SELECTEDVALUE('YourTable'[Start_Date]) -- Replace with your actual date column
VAR AgeInDays = DATEDIFF(StartDate, SelectedDate, DAY)
VAR AgeInWeeks = DIVIDE(AgeInDays, 7)
RETURN AgeInWeeks
If this helps, I would appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!