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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
dawcza3
Frequent Visitor

Calculate Age with Direct Query Support

 

I'm trying to calculate Age from DateOfBirth. Actually I'm do this with transformation date to age and round down. It's works ok, but it not avalaible to use data in direct query mode. So, is there any other way to calculate age which support direct query mode ?

1 ACCEPTED SOLUTION
dawcza3
Frequent Visitor

@v-ljerr-msft

 

thanks for replay but actually I do this in simple way :

Age = ROUNDDOWN(((1,0*(TODAY()-Partner[DateOfBirth]))/365);0)

View solution in original post

4 REPLIES 4
dawcza3
Frequent Visitor

@v-ljerr-msft

 

thanks for replay but actually I do this in simple way :

Age = ROUNDDOWN(((1,0*(TODAY()-Partner[DateOfBirth]))/365);0)

Hi @dawcza3,

 

Nice solution!

 

Could you accept your reply as solution to help others who may have similar issue easily find the answer and close this thread?Smiley Happy

 

Regards

Noob question, my apologies. I have a very similar need and don't understand where I would define "Age" so that it can be included in the visualization. Is this a new column, or a measure?

 

Secondly, could it be applied to a summarized result. Using this example, to find the age of the youngest person in a family?

v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @dawcza3,

 

According to your description above, you should be able to use the formula below to create a calculate column to calculate age in direct query mode.Smiley Happy

Age =
YEAR ( TODAY () ) - YEAR ( Table1[DateOfBirth] )
    + IF (
        DATE ( 1900, MONTH ( TODAY () ), DAY ( TODAY () ) )
            < DATE ( 1900, MONTH ( Table1[DateOfBirth] ), DAY ( Table1[DateOfBirth] ) ),
        - 1,
        0
    )

Regards

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors