Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ktt777
Helper V
Helper V

conveting text and number in age calculation

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 ?

 

NameBirthday Age
A1/1/20221.17
B  
C1/12/20220.25

 

thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ktt777 ,

You can create a calculated column as below to get it:

Age = DIVIDE ( DATEDIFF ( 'Table'[Birthday], DATE ( 2023, 3, 19 ), MONTH ), 12 )

vyiruanmsft_0-1680159578991.png

Best Regards

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @ktt777 ,

You can create a calculated column as below to get it:

Age = DIVIDE ( DATEDIFF ( 'Table'[Birthday], DATE ( 2023, 3, 19 ), MONTH ), 12 )

vyiruanmsft_0-1680159578991.png

Best Regards

ppm1
Solution Sage
Solution Sage

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.

 

AgeMeasure = CALCULATE(AVERAGE(Person[Total Years]), Person[Total Years] <> 0)
 
Alternatively, you can avoid adding an extra column at all and just use a measure to calculate it.
 
AgeMeasure2 =
CALCULATE (
AVERAGEX ( Person, INT ( TODAY () - Person[Birthdate] ) / 365 ),
NOT ( Person[Birthdate] IN { TODAY (), BLANK () } )
)
 
Pat
Microsoft Employee
YukiK
Impactful Individual
Impactful Individual

Use a formula like this:

Your Column = DIVIDE( DATEDIFF ( BIRTHDAYCOLUMN, TODAY (), DAY ), 365 )

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.