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

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

Reply
Anonymous
Not applicable

Histogram using birthday dates

Hello,

I have a column of dates (birthdays), and I want to create a histogram showing counts within an age range, for example

 

01-02

03-05

06-12
13-17
18-21
22-30
31-40
41-50
51-65
66-75
75 +

Ive tried using the Histogram visual, but this seems problematic as it does not allow me to standardize the age ranges as described above.  Any ideas?

1 ACCEPTED SOLUTION
jahida
Impactful Individual
Impactful Individual

Oh yeah my bad, forgot that was illegal. How's:

 

CountDOB = COUNTROWS(FILTER(Sheet1, DATEDIFF(Sheet1[DOB], TODAY(), YEAR) >= MIN('HistAges'[AgeLowerBound]) && DATEDIFF(Sheet1[DOB], TODAY(), YEAR) <= MAX('HistAges'[AgeUpperBound'])))

View solution in original post

4 REPLIES 4
jahida
Impactful Individual
Impactful Individual

One possible solution would be to make a second table (say, 'HistAges').

 

3 columns: Range Visual (formatted like you listed below, or however else you want), Lower Bound, Upper Bound.

 

Then you can make a Measure to count birthdays in each range. Maybe:

 

Count = CALCULATE(COUNTROWS('Table'), DATEDIFF('Table'[Date], TODAY(), YEAR) >= MIN('HistAges'[Lower Bound]), DATEDIFF('Table'[Date], TODAY(), YEAR) <= MAX('HistAges'[Upper Bound]))

 

You can then graph Range Visual against the measure to get your desired result. Too lazy to test, so sorry if there are syntax errors.

Anonymous
Not applicable

thanks @jahida,

 

I created the new table as described.  And have the following measure...

 

CountDOB = CALCULATE(COUNTROWS(Sheet1), DATEDIFF(Sheet1[DOB], TODAY(), YEAR) >= MIN('HistAges'[AgeLowerBound]), DATEDIFF(Sheet1[DOB], TODAY(), YEAR) <= MAX('HistAges'[AgeUpperBound]))

 

Sheet1[DOB] = Birthday in date format

HistAges'[AgeLowerBound] = column within the new table for lower age boundry

'HistAges'[AgeUpperBound] = column within new table for upper age boundry

 

However the measure returns the following error. "A function 'MIN' has been used in a True/False expression that is used as a table filter expression. This is not allowed"

 

Any ideas?  thanks in advance for your help.

 

 

jahida
Impactful Individual
Impactful Individual

Oh yeah my bad, forgot that was illegal. How's:

 

CountDOB = COUNTROWS(FILTER(Sheet1, DATEDIFF(Sheet1[DOB], TODAY(), YEAR) >= MIN('HistAges'[AgeLowerBound]) && DATEDIFF(Sheet1[DOB], TODAY(), YEAR) <= MAX('HistAges'[AgeUpperBound'])))

Anonymous
Not applicable

Amazing! @jahida

 

You're the best, thank you.

Helpful resources

Announcements
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