Forum Discussion
Calculating age from a date and time
- 9 years ago
Anonymous
Use "New Column" not "New Measure"
Anonymous
hi,
To calculate the age in Days:
Age = DATEDIFF(Table1[DateTimeColumn],TODAY(),DAY)
to calculate the days between the start and end.
DaysBetween = DATEDIFF(Table1[StarDate],Table1[EndDate],DAY)
- Anonymous9 years agoNot applicable
Thanks you...
I seem to have done something wrong (assuming it's me as a newbie):
- Vvelarde9 years ago
Community Champion
Anonymous
Use "New Column" not "New Measure"
- Anonymous9 years agoNot applicable
Thank you for taking the time to help me, it's much appreciated.
- MarcelBeug9 years ago
Community Champion
My best guess is that you need to choose "New Column" first.
- Anonymous6 years agoNot applicable
I used the Query Editor to "Insert a Custom Column" (Add Column tab). I inserted the formula given here, but PowerBI doesn't seem to like the DATEDIFF function. The system inserted the Table.AddColumn bit up to the DATEDIFF.
= Table.AddColumn(#"Removed Columns", "ItemAge", each DATEDIFF([FirstDetected],TODAY(),DAY))Advice welcome.
- jdubs1 year ago
Helper V
Hello,
If I then wanted to create a measure of the AVERAGE of all the "ages" how would I achieve this?