Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
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 ID | Class | Rank | Label |
| 1265 | move to A | 1 | Behavior not Yet Recognized |
| 1265 | move to A | 1 | Behavior not Yet Recognized |
| 3489 | move to B | 1 | move to B |
| 1265 | move to C | 3 | |
Solved! Go to Solution.
something like this?
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 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()
)
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()
)
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.
| CustID | Class | Rank |
| 33445 | Move to A | 1 |
| 33445 | Move to B | 1 |
| 45657 | Move to B | 1 |
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?
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()
)
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")
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,
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
Proud to be a Super User! | |
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.