Forum Discussion
Syndicate_Admin
3 years agoAdministrator
Add years to a date column.
Good. I need to add a certain number of years to a column of dates. I have found solution with M language in query or through queries. I would like to know the solution through DAX since I want to do...
- 3 years ago
pls try this
Measure = VAR _Curentdate = SELECTEDVALUE('Table'[Date]) VAR _offset1 = MONTH(_Curentdate) *5 *12 VAR _offset2 = MONTH(_Curentdate)*2 *12 RETURN SWITCH( TRUE(), _Curentdate>= DATE(2023,1,1), EDATE(_Curentdate,_offset1), EDATE(_Curentdate,_offset2))
Syndicate_Admin
3 years agoAdministrator
Good
Thanks for the reply. I have tried what it proposes and it works for me. In fact, I have accepted it as a solution. The problem is that I always try to solve through measures and avoid calculated columns as much as possible. I am trying to implement the same solution with a measure but I am not able. Could you tell me how I can apply the same solution to a measure? Thank you so much. Best regards.
Ahmedx
3 years agoSuper User
pls try this
Measure =
VAR _Curentdate = SELECTEDVALUE('Table'[Date])
VAR _offset1 = MONTH(_Curentdate) *5 *12
VAR _offset2 = MONTH(_Curentdate)*2 *12
RETURN
SWITCH( TRUE(),
_Curentdate>= DATE(2023,1,1), EDATE(_Curentdate,_offset1), EDATE(_Curentdate,_offset2))