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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
NumeroENAP
Helper III
Helper III

Average measure with age calculation measure

Hi, 

I want my table to show the average age of each categories (ex : by gender), but I don't want to create a column. So, I created a first measure : 

Age = DATEDIFF(ALL(PERS[date]);TODAY();DAY)
 
After that, I created a second measure, but it seems that I'm in the wrong, because it doesn't work :
AgeAVG = AVERAGEX(ALL(ID);[Age])
 
Thank you
1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @NumeroENAP 

Please show a sample of your tables/data model. Otherwise we waste time. Have a look at these tips for getting your question answered quickly.  Try this measure:

Measure =
AVERAGEX ( VALUES ( Table1[ID] ), DATEDIFF ( Table1[Date of birth], TODAY (), YEAR ) )

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

View solution in original post

1 REPLY 1
AlB
Community Champion
Community Champion

Hi @NumeroENAP 

Please show a sample of your tables/data model. Otherwise we waste time. Have a look at these tips for getting your question answered quickly.  Try this measure:

Measure =
AVERAGEX ( VALUES ( Table1[ID] ), DATEDIFF ( Table1[Date of birth], TODAY (), YEAR ) )

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.