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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.