Forum Discussion
Customer segmentation
- 3 years ago
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.
- eliasayyy3 years agoMemorable Member
thank you for clarifying please try
for measureLabel = 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
- Mncedi3 years agoRegular Visitor
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".
- eliasayyy3 years agoMemorable Member
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() )