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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

dynamically age group

I have a measure that calculates the age dynamically considering  the date selected by the user. but I can't group the results. the simplest solution would be to calculate the age in a column calculated to today but this is no solution as my user may want to select dates in the past and the age must be in relation to the selected date

 

formula dax calculate age

 

 

age = VAR Birthdate = table[Date of birth]
VAR ThisDay = MAX('Calendar'[Date])
VAR IntBirthdate = YEAR ( Birthdate ) * 10000 + MONTH ( Birthdate ) * 100 + DAY ( Birthdate )
VAR IntThisDay = YEAR ( ThisDay ) * 10000 + MONTH ( ThisDay ) * 100 + DAY ( ThisDay )
VAR Age = QUOTIENT ( IntThisDay - IntBirthdate, 10000 )
VAR CheckedAge = DIVIDE ( Age, NOT ISBLANK ( Birthdate ) )
RETURN
CheckedAge

 

 

range age 

range ageorder 
<=201
21-302
31-403
41-504
51-605
60+6

 

thank you very much

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous ,

You need to have measure like

 

new measure =
var _1 = maxx(allselected('Date', 'Date'[Date])
return
datediff(min(Table[Birthdate]),_1,year)

 

Then you need to do bucket using person/user

example

Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1387187#M626


Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

thanks @amitchandak 

amitchandak
Super User
Super User

@Anonymous ,

You need to have measure like

 

new measure =
var _1 = maxx(allselected('Date', 'Date'[Date])
return
datediff(min(Table[Birthdate]),_1,year)

 

Then you need to do bucket using person/user

example

Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1387187#M626


Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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