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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

How to group by summed amounts?

I'm trying to figure out how take the total sales amount for filtered list of customers, catagorize them (e.g., Large, Medium, Small) and provide a count for those catagories.

For instance, if I want Large >= $100K, Med $25K to $100K , Small under $25K and my table is:

Customer      Product     Amount

================================

Customer A     ABC       $80,000

Customer A     XYZ       $40,000

Customer B     ABC       $20,000

Customer B     XYZ       $60,000

Customer c     XYZ        $7,000

 

I would like to be able to produce:

Category      Count

==============

Large             1

Medium        1

Small             1

 

If I were using Tableau, I would use a CASE statement and a LEVEL OF DETAIL calc, but I can't figure out how to do this with DAX. Also, I'm using Direct Query, so functions like ALLCOLUMNS won't work.

 

3 REPLIES 3
Anonymous
Not applicable

Actually upon further examination, the solution isn't using the additional tables, but it still doesn't work properly when any filter is applied.

Anonymous
Not applicable

This solution breaks the data query out into separate joined datasets. My data is structured like shown above, in a single flat file. As such, this solutions doesn't work as it counts multiple rows for each customer and doesn't aggregate them. I need to keep my original query as to much stuff is already built on it, but I guess I could build new queries to use this solution. I just wish I could do it as is, with different DAX statement.

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating measures to solve.

 

Jihwan_Kim_0-1663384384107.png

 

Jihwan_Kim_1-1663384414365.png

 

Customers count by category: =
CALCULATE (
    COUNTROWS ( Customer ),
    FILTER (
        Customer,
        COUNTROWS (
            FILTER (
                Category,
                [Sales amount:] >= Category[Min]
                    && [Sales amount:] < Category[Max]
            )
        ) >= 1
    )
)

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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