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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
dataaanana
Frequent Visitor

Need help in creating a histogram from measures

Hello! I'm currently really struggling on how I can create my desired output, kindly share your insights please.

I have an [Age] measure and [Age Category] measure. Is there a way for me to group and count all the employees based on their age category? I want to create a histogram that will group or count all my employees based on the following age categories:

• Under 25
• 25-34
• 35-44
• 45-54
• 55+Group.png

1 REPLY 1
AnalyticPulse
Super User
Super User

thats simple.

Create new column for the age categories;
Age Category =
VAR Age = 'Employee'[Age]
RETURN
SWITCH(
TRUE(),
Age < 25, "Under 25",
Age >= 25 && Age <= 34, "25-34",
Age >= 35 && Age <= 44, "35-44",
Age >= 45 && Age <= 54, "45-54",
Age >= 55, "55+",
BLANK()
)

Now create new column for sorting the above categories:
Age Category Serial Number =
VAR AgeCategory = 'Employee'[Age Category]
RETURN
SWITCH(
AgeCategory = "Under 25", 1,
AgeCategory = "25-34", 2,
AgeCategory = "35-44", 3,
AgeCategory = "45-54", 4,
AgeCategory = "55+", 5,
BLANK()
)

 

Click on Age Category column and go to home tab then click on sort by and now click on - Age Category Serial Number.

now use the new column Age Category  in your histogram on y axis, and sort your y axis by Age Category column in ascending.(click on funnel icon on top right corner of the visual).

and done.

If this helped, Please Subscribe AnalyticPulse on YouTube for future updates:
https://www.youtube.com/@AnalyticPulse
https://instagram.com/analytic_pulse
https://analyticpulse.blogspot.com/

Please subscribe CogniJourney On Youtube For fun facts:
https://www.youtube.com/@CogniJourney

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors