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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Super User
Super User

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
Super User
Super User

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors