Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Hello:
My goal is very simple - create "age categories" based on the Age2 measure field so that I can stratify by age groups. The code below works as indicated by the screenshot below. However, when I remove the Age2 field, the results are inaccurate as only one category remains which is clearly not correct. I suspect it's because the DAX expression below needs another statement to level according to the dimension that I want to display the age groups by?
Any advice is appreciated. I'm very new to writing DAX and apologize if this is very basic. I have an SSAS Tabular model and am trying to use DAX to create these groups rather than having to build into the model.
Regards,,
Rob
DAX:
Age Category = SWITCH(TRUE(),
AND([Age2]>=0, [Age2]<=60),"<60",
AND([Age2]>60,[Age2]<70),"61-70",
"Older than 70")
Solved! Go to Solution.
Download Sample PBIX: Age Example
Hi, Are you trying to show result as shown? You can add an index column to your Age table and use your existing DAX to add your Groupings as a new colum. Results shown above.
Download Sample PBIX: Age Example
Hi, Are you trying to show result as shown? You can add an index column to your Age table and use your existing DAX to add your Groupings as a new colum. Results shown above.
Yes, that's the outcome I'm trying to achieve. The Tabular Model is not available for me to alter, I have to use a calculated measure to achieve my desired result. I will try your idea above and I do appreciate your reply.