Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
PDRTXRA
Helper I
Helper I

Grouping

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?

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @PDRTXRA ,

According to your description, here's my solution.

Sample:

vyanjiangmsft_0-1689760153460.png

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:

vyanjiangmsft_1-1689760316026.png

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.

 

View solution in original post

1 REPLY 1
v-yanjiang-msft
Community Support
Community Support

Hi @PDRTXRA ,

According to your description, here's my solution.

Sample:

vyanjiangmsft_0-1689760153460.png

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:

vyanjiangmsft_1-1689760316026.png

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.

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.