I use the datedif formula a lot to emphasize time frames. I can do it in excel no problem with
I can even doing it in the power query model using this formula:
I am practicing and attempting to be able to do it using power query on my data cleanup and transformation with out having to either add formula to excel or run in power pivot
Is this possible in Power Pivot using the M language?
I have attached my training file. Looking for some direction in Power query if it is possible. Thanks
Code:
=IF(DATEDIF(A4,B4,"y")=0,"",DATEDIF(A4,B4,"y")&" years ")&IF(DATEDIF(A4,B4,"ym")=0,"",
DATEDIF(A4,B4,"ym")&" months ")&DATEDIF(A4,B4,"md")&" days"
I can even doing it in the power query model using this formula:
Code:
= IF ( INT ( YEARFRAC ( [From Date] - ( DAY ( [From Date] ) - 1 ) * 1.0 , [To Date] - DAY ( [From Date] ) ) ) = 0, "", INT ( YEARFRAC ( [From Date] - ( DAY ( [From Date] ) - 1 ) * 1.0 , [To Date] - DAY ( [From Date] ) ) ) & " years " )
& IF ( INT ( DIVIDE ( ( YEARFRAC ( [From Date] - ( DAY ( [From Date] ) - 1 ) * 1.0 , [To Date] - DAY ( [From Date] ) ) - INT ( YEARFRAC ( [From Date] - ( DAY ( [From Date] ) - 1 ) * 1.0 , [To Date] - DAY ( [From Date] ) ) ) ), 1 / 12 ) ) = 0, "",
INT ( DIVIDE ( ( YEARFRAC ( [From Date] - ( DAY ( [From Date] ) - 1 ) * 1.0 , [To Date] - DAY ( [From Date] ) ) - INT ( YEARFRAC ( [From Date] - ( DAY ( [From Date] ) - 1 ) * 1.0 , [To Date] - DAY ( [From Date] ) ) ) ), 1 / 12 ) ) & " months " )
& IF ( [To Date] - DAY ( [From Date] ) = EOMONTH ( [To Date] - DAY ( [From Date] ) , 0 ), "", DAY ( [To Date] - DAY ( [From Date] ) ) & " days" )
I am practicing and attempting to be able to do it using power query on my data cleanup and transformation with out having to either add formula to excel or run in power pivot
Is this possible in Power Pivot using the M language?
I have attached my training file. Looking for some direction in Power query if it is possible. Thanks