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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
MaxwellB
New Member

DAX Recategorise

Hi All,

 

I am hoping to get a quick hand on how to create a DAX column in my model.

 

I am looking to recategorise Individual rows with a DAX expression where a user could fall into one of two categories (A or B) and in any case where a user has been tagged as category A, we want to recategorise those other rows as category A also.  My original data looks like this:

 

UserCategory
1A
1B
1B
1A
2B
2B
2B
3B
3B
3A

 

I want to add a column with a DAX expression which recategorises the Users based if any row is category A such that the results should look like this:

 

UserCategoryRecategorised
1AA
1BA
1BA
1AA
2BB
2BB
2BB
3BA
3BA
3AA

 

This looks like it should be a simple expression but I haven't been able to work it out so far.

 

Thanks

1 ACCEPTED SOLUTION
Dangar332
Super User
Super User

hi, @MaxwellB 

try below code for column 

Column = 
var category_value = CALCULATETABLE(VALUES('Table (2)'[Category]),ALL('Table (2)'[Category]))
RETURN
IF("A" in category_value,"A",'Table (2)'[Category])

 

Dangar332_0-1710413550166.png

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Dangar332
Super User
Super User

hi, @MaxwellB 

try below code for column 

Column = 
var category_value = CALCULATETABLE(VALUES('Table (2)'[Category]),ALL('Table (2)'[Category]))
RETURN
IF("A" in category_value,"A",'Table (2)'[Category])

 

Dangar332_0-1710413550166.png

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Amazing thank you! 😊

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.