I am trying to create a column which calculates the age of the given person. i followed the below procedure
1. create " new column"
u can see the formula in the image below.
as you can see it gives me the above error , even when i move the today() function in the beginning. so instead i inserted today's date. it does calculate but it gives really weird calculations. pls see below
any help will be appreciated
Solved! Go to Solution.
@Eric_Zhang : Thank you for the solution.It was really elegant. another question. some date of birth fields are blank and the value returned is 2017. Which conditional statement to use so that when 2017 is returned it inputs a null value in the field.?
So what you should try is
either FLOOR(DATEDIFF([DOB], TODAY(), DAY) / 365.25, 1)
or ROUNDDOWN(DATEDIFF([DOB], TODAY(), DAY) / 365.25, 0)
@abhijeet dividing by 365.25 is not really a good idea either.
A correct Power Query solution can be found in this topic.
Basically the 2 dates are converted to a number with yyyyMMdd, subtracted and integer-divided by 10,000
Example: 20,171,006 - 19,620,421 = 550,585 => 55
So you don't agree with a correct solution? Strange.
Then you might as well disagree with the approach to add 2 numbers as number1 + number2.
This is just black and white mathematics, which is either correct or wrong. Nothing to (dis)agree.
There will be other correct solutions people may prefer, though.
Example: your solution Oct 6, 2016 to Oct 6, 2017 returns 0 instead of 1.
Oh goodness. Its not the maths that I am talking about. I know the arithmentic here quite well. I mean the DAX vs M code. String and especially date manipulation in M code is far more tedious. Manipulation of and calculations in DAX are my prefernce. So that'ss what I am trying to say. No need to get nasty please.