Forum Discussion
Garbo62
3 years agoResolver I
DAX DATEDIFF
I'm looking for a DAX query to return the difference between to dates in the format of x Years & y months I have the following that nearby works Years = DATEDIFF(cr6fb_gpe_a_aset[AAsetProcDate],...
- 3 years ago
Hi Garbo62
Try to use this formula
YearMonths =
VAR Years = DDATEDIFF(cr6fb_gpe_a_aset[AAsetProcDate], TODAY(), YEAR)
VAR Months = DATEDIFF(cr6fb_gpe_a_aset[AAsetProcDate], Today(),MONTH) - Years * 12
RETURN CONCATENATE(CONCATENATE(CONCATENATE(Years," Years, "),Months)," Months")
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickl - 3 years ago
Hi, Solved it
Age = INT(DATEDIFF(cr6fb_gpe_a_aset[AAsetProcDate], TODAY(), MONTH)/12) & " Years & " & DATEDIFF(cr6fb_gpe_a_aset[AAsetProcDate], TODAY(), MONTH) - INT(DATEDIFF(cr6fb_gpe_a_aset[AAsetProcDate], TODAY(), MONTH)/12)*12 & " Months"
Garbo62
3 years agoResolver I
Hi, Solved it
Age = INT(DATEDIFF(cr6fb_gpe_a_aset[AAsetProcDate], TODAY(), MONTH)/12) & " Years & " & DATEDIFF(cr6fb_gpe_a_aset[AAsetProcDate], TODAY(), MONTH) - INT(DATEDIFF(cr6fb_gpe_a_aset[AAsetProcDate], TODAY(), MONTH)/12)*12 & " Months"