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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount 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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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