Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
hi,
how can i use dax formula to create column Age with data type as decimal and the value is blank if the data in Birthday column is blank
then how to calculate average to exclude zero or null ?
Name | Birthday | Age |
A | 1/1/2022 | 1.17 |
B | ||
C | 1/12/2022 | 0.25 |
thanks
Solved! Go to Solution.
Hi @ktt777 ,
You can create a calculated column as below to get it:
Age = DIVIDE ( DATEDIFF ( 'Table'[Birthday], DATE ( 2023, 3, 19 ), MONTH ), 12 )
Best Regards
Hi @ktt777 ,
You can create a calculated column as below to get it:
Age = DIVIDE ( DATEDIFF ( 'Table'[Birthday], DATE ( 2023, 3, 19 ), MONTH ), 12 )
Best Regards
FYI that the Power Query editor has an Age function on the Add Column tab. That will create a duration column in days you can conver to Total Years. You can then use a measure like this to get the average.
Use a formula like this:
Your Column = DIVIDE( DATEDIFF ( BIRTHDAYCOLUMN, TODAY (), DAY ), 365 )