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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
AliceW
Power Participant
Power Participant

Create a filter with amounts per Customer coming from several Opportunities - it can't be a measure

Hi guys,

This should be simple, but I just can't figure out how to do it, so help :0)

What I have:

I have a table with Customers and Opportunities. One Customer can have one or several Opportunities.

What I need:

To calculate a column (so I can use as a page filter) with the Total Amount per Customer. Based on that, I can create various categories (see 'Customer Total' column below).

 

CustomerOpp #AmountCustomer Total
AAA11000Between 0 and 3000
AAA22000Between 0 and 3000
AAA33000Between 0 and 3000
BBB44000Between 3001 and 5000
BBB55000Between 3001 and 5000

 

If I just create a measure CustomerTotal = sum(Amount) I won't have a filter... 😞

Big thanks,

Alice

1 ACCEPTED SOLUTION
edhans
Super User
Super User

You can create a calculated column that has customer totals using this:

Customer Total = 
VAR CurrentCustomer = Sales[Customer]
RETURN
    CALCULATE(
        SUM(Sales[Amount]),
        FILTER(
            Sales,
            Sales[Customer] = CurrentCustomer
        )
    )

You can then create another column to use as your filter amount using SWITCH for your ranges:

Customer Range = 
SWITCH(
    TRUE(),
    Sales[Customer Total] <  3000, "Between 0 and 3000",
    AND(Sales[Customer Total] > 3000,Sales[Customer Total] <= 5000), "Between 3001 and 5000",
    "Over 5000"
    )


Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

2 REPLIES 2
edhans
Super User
Super User

You can create a calculated column that has customer totals using this:

Customer Total = 
VAR CurrentCustomer = Sales[Customer]
RETURN
    CALCULATE(
        SUM(Sales[Amount]),
        FILTER(
            Sales,
            Sales[Customer] = CurrentCustomer
        )
    )

You can then create another column to use as your filter amount using SWITCH for your ranges:

Customer Range = 
SWITCH(
    TRUE(),
    Sales[Customer Total] <  3000, "Between 0 and 3000",
    AND(Sales[Customer Total] > 3000,Sales[Customer Total] <= 5000), "Between 3001 and 5000",
    "Over 5000"
    )


Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
AliceW
Power Participant
Power Participant

Thank you so much!!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.