Forum Discussion
Need help in creating a histogram from measures
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