Forum Discussion
Yearfrac in Query editor does not work?
Hey there,
I'm trying to add a custom column showing the days (financial year) between to dates with:
"=yearfrac([StartDate],[EndDate],2)".
When I enter my code in the wizard for custom columns there is no syntax error but after clicking OK it keeps returning an error.
Translated from German it says: "I did not get Yearfrac. Is it written correctly?"
Can anybody help?
Best
Nico
- Anonymous8 years ago
The Query Editor side of things uses a language called Power Query M, not DAX. As far as I know, YEARFRAC is only available in DAX, so that would be a measure or a calculated column after your data is loaded, rather than a custom column in the Query Editor.
3 Replies
- ChrisMendozaResident Rockstar
If a Power Query solution is needed, try as a Custom Column:
M YEARFRAC ( ) = Duration.TotalDays([EndDate] - [StartDate]) / 360
Basis from your example was '2' - Actual / 360
You might need to figure out the precision however as this was my result:
- AnonymousNot applicable
The Query Editor side of things uses a language called Power Query M, not DAX. As far as I know, YEARFRAC is only available in DAX, so that would be a measure or a calculated column after your data is loaded, rather than a custom column in the Query Editor.
- v-piga-msftResident Rockstar
Hi Nicolas_viet,
Have you solved your problem?
If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
Best Regards,
Cherry