Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Is there a formula to assign a customer to a group based on certian items they have? If the customer has one of the bold letter items in the group below they will automatically be assigned to that group even if they have other items that are not in bold letters
Data set 1
Group 1 - car, house, bike, motorcycle
Group 2 - car, boat
Group 3 - house, motorcycle
Data set 2
David - house, motorcycle, bike
John - car, boat
Mike - house, car
Return value
David = Group 1
John = Group 2
Mike = Group 3
Thanks in advance!
Solved! Go to Solution.
Is this a Measure or Calc Column?
If its a column then this should work - not sure how your data is organized so I took a guess. after I wrote the below I rememberd you can probalby use the IN {"house","car"} vs the || operator but I think you will get the approach. If you need more help can you can share your model and table layout even if its just the field names and header rows and give a better idea of the resutls your after.
Group Column = SWITCH(TRUE(), CALCULATE(COUNTROWS(VALUES(policies[PolicyType]), FILTER(policies,policy[type]="car"||policy[type]="house"||policy[type]="bike"||policy[type]="motorcycle")=4,"1", CALCULATE(COUNTROWS(VALUES(policies[PolicyType]), FILTER(policies,policy[type]="car"||policy[type]="boat"||=2,"2" ….
Is this a Measure or Calc Column?
If its a column then this should work - not sure how your data is organized so I took a guess. after I wrote the below I rememberd you can probalby use the IN {"house","car"} vs the || operator but I think you will get the approach. If you need more help can you can share your model and table layout even if its just the field names and header rows and give a better idea of the resutls your after.
Group Column = SWITCH(TRUE(), CALCULATE(COUNTROWS(VALUES(policies[PolicyType]), FILTER(policies,policy[type]="car"||policy[type]="house"||policy[type]="bike"||policy[type]="motorcycle")=4,"1", CALCULATE(COUNTROWS(VALUES(policies[PolicyType]), FILTER(policies,policy[type]="car"||policy[type]="boat"||=2,"2" ….
Thanks all!
What happens if person has both bold items belongs to diffrent groups, what group he will be assigned in that case?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
They would be assigned to the highest group.
The Ranking would be Group 1 > Group 2 > Group 3
User | Count |
---|---|
139 | |
113 | |
103 | |
73 | |
63 |
User | Count |
---|---|
136 | |
125 | |
107 | |
70 | |
61 |