cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dawcza3 Frequent Visitor
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

Accepted Solutions
dawcza3 Frequent Visitor
Frequent Visitor

Re: Calculate Age with Direct Query Support

@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
Microsoft v-ljerr-msft
Microsoft

Re: Calculate Age with Direct Query Support

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

dawcza3 Frequent Visitor
Frequent Visitor

Re: Calculate Age with Direct Query Support

@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

Microsoft v-ljerr-msft
Microsoft

Re: Calculate Age with Direct Query Support

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

Brian820 New Member
New Member

Re: Calculate Age with Direct Query Support

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?

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors (Last 30 Days)