My goal is to covert hired dates to months with the company. I used the PQ to transform the date to age, then transformed the age to years using the Duration button, however, there is no months option in the dropdown, only total years, days, hours etc. Is there a way to transform to total months using the options in the transform ribbon or does this require a custom function using M code?
Thanks!
Hi Tykru,
There's no built in way to calculate it but this post offers a solution. However, it is simpler to do this calculation in Power Pivot using the DATEDIF function.
Mynda
Hi,
If you have the age in years, adding a column that multiplies the age by 12 should be enough, normally the age in years should have decimals, so 3.25 years*12 = 39 months for example.
Awesome, I will take a look at both and see what works for me. I considered using DAX in Power Pivot but am only working from one table so I didn't add to PP data model because how simplistic my solution is. Can you use PP to create measures with only one table?
Thanks!
Yes, DAX measures can be written for one table.
I've tried both Catalin's and your suggestion and they work great. However, when I round both 1 decimal place, the DAX version will round way up (i.e. the M code result will be 11.2 and the DAX will round up to 12.0). Any idea why?
Thanks,
Tyler