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
Mncedi
Regular Visitor

Customer segmentation

I have a dataset that has customer classifications based on recognized behavior. The most frequent behave is ranked 1. Some customers have a rank of 1 in two different classifications, meaning same frequent behavior recognized. I want to return classes that has rank 1 and in case there are different classes with rank 1, assign label = 'behavior not yet recognized'. If the rank > 1, label = blank. 

Customer IDClassRankLabel
1265move to A 1Behavior not Yet Recognized
1265move to A1Behavior not Yet Recognized
3489move to B1move to B
1265move to C3 
    
1 ACCEPTED SOLUTION

something like this?

annonymous1999_2-1691658905103.png

 

 

 

Label 1 = 
VAR _c = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Rank],'Table'[Customer ID]))
RETURN
SWITCH(
    TRUE(),
    AND( 'Table'[Rank] = 1 , _c >1) , "Behavior Not Recogonized" ,
    AND('Table'[Rank] = 1 , _c = 1) , 'Table'[Class],
    BLANK()
)

 

 

View solution in original post

7 REPLIES 7
Mncedi
Regular Visitor

Thank you so much for your kind response@Idrissshatila 

Maybe let me rephrase my question. I have some customers in the table who happen to have say two frequent classes that have the same rank of 1. If the customer has rank =1 then return the corresponding class. However, if the customer has two or more classes that have the same rank I want to assign them " behavior not yet recognized". Otherwise if class has rank =1 and other classes have rank >1 then return class with rank =1. 

thank you for clarifying please try 

for measure

 

 

Label = 
VAR _c = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Class],'Table'[Rank]))
RETURN
SWITCH(
    TRUE(),
    AND( MAX('Table'[Rank]) = 1 , _c >1) , "Behavior Not Recogonized" ,
    AND(MAX('Table'[Rank]) = 1 , _c = 1) , MAX('Table'[Class]),
    BLANK()
)

 

 

annonymous1999_0-1691658388800.png

 

for calculated column 

 

 

Label 1 = 
VAR _c = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Class],'Table'[Rank]))
RETURN
SWITCH(
    TRUE(),
    AND( 'Table'[Rank] = 1 , _c >1) , "Behavior Not Recogonized" ,
    AND('Table'[Rank] = 1 , _c = 1) , 'Table'[Class],
    BLANK()
)

 

 



annonymous1999_0-1691658680288.png

 

please leave a thumbs up if i helped you solve your question

Thanks once again.

Sorry, I made a mistake, the customer has different classes of the same rank of 1.

CustIDClassRank
33445Move to A1
33445Move to B1
45657Move to B1

 

I want to assign a calculated column or measure that will return for me the class when the rank is 1. For customers like the one of ID 33445, that have the same rank of 1 but have different classes, return "behavior not recognized".

something like this?

annonymous1999_2-1691658905103.png

 

 

 

Label 1 = 
VAR _c = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Rank],'Table'[Customer ID]))
RETURN
SWITCH(
    TRUE(),
    AND( 'Table'[Rank] = 1 , _c >1) , "Behavior Not Recogonized" ,
    AND('Table'[Rank] = 1 , _c = 1) , 'Table'[Class],
    BLANK()
)

 

 

Thank you @eliasayyy ,

That is wonderful, it is working👌.

eliasayyy
Memorable Member
Memorable Member

i think a simple if measure will solve your issue

 

Measure = 
IF(MAX('Table'[Rank]) = 1 , "Behavior Not yet Recognized")


while in a calculated column 


 

Measure = 
IF('Table'[Rank] = 1 , "Behavior Not yet Recognized")​
Idrissshatila
Super User
Super User

Hello @Mncedi ,

 

if you mean you want a dax measure that you can add on a calculated column then use the following:

 

Label = if ( 'YourTableName'[Rank] = 1,"behavior not yet recognized",if ( 'YourTableName'[Rank] > 1,

BLANK()))
 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Follow me on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.