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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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