The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I have a table of purchases.
Each row is a purchase with an unique ID and a ClientID.
Each client can have multiple purchases.
I want to group based on how much each client spent.
Lets say I want 5 groups:
0-100€
100-200€
200-500€
500-1000€
> 1000 €
Any help on the correct approach?
Solved! Go to Solution.
Hi @PDRTXRA ,
According to your description, here's my solution.
Sample:
Create a measure:
Measure =
VAR _SUM =
SUM ( 'Table'[Purchase] )
RETURN
SWITCH (
TRUE,
_SUM > 0
&& _SUM <= 100, "0-100€",
_SUM > 100
&& _SUM <= 200, "100-200€",
_SUM > 200
&& _SUM <= 500, "200-500€",
_SUM > 500
&& _SUM <= 1000, "500-1000€",
_SUM > 1000, ">1000€"
)
Get the correct result:
I attach my sample below for your reference.
Best regards,
Community Support Team_yanjiang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @PDRTXRA ,
According to your description, here's my solution.
Sample:
Create a measure:
Measure =
VAR _SUM =
SUM ( 'Table'[Purchase] )
RETURN
SWITCH (
TRUE,
_SUM > 0
&& _SUM <= 100, "0-100€",
_SUM > 100
&& _SUM <= 200, "100-200€",
_SUM > 200
&& _SUM <= 500, "200-500€",
_SUM > 500
&& _SUM <= 1000, "500-1000€",
_SUM > 1000, ">1000€"
)
Get the correct result:
I attach my sample below for your reference.
Best regards,
Community Support Team_yanjiang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the July 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
109 | |
67 | |
46 | |
41 |
User | Count |
---|---|
188 | |
86 | |
77 | |
74 | |
60 |