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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Sum and count customers in different value intervals

Hi,

 

I've got a datasets with alot of rows for different customer numbers and sales value. I want to sum the sales value on each customer and then show the number of customers and the total sales value in different categories.

 

For example, I want to show the total value of all the customers that has a sales value < 10 000$. Then another group for between 10 000$ - 20 000$, and so on.

 

I might need to work on the description of my problem, but this is basicly what I want it to look like:

GroupsNumber of customersTotal sales
<10 000$123950 000
10 000$-20 000$751 100 000

 

Any feedback would be greatly appreciated.

1 ACCEPTED SOLUTION
mattbrice
Solution Sage
Solution Sage

If you create a parameter table with the ranges you want like this:

  tablerange.gif


then with Range Table desciption on rows, use these measures: 

 

Number of Customers =
COUNTROWS (
    FILTER (
        ADDCOLUMNS (
            VALUES ( CustomerID[ID] ),
            "Total Sales", CALCULATE ( SUM ( Sales[Sales] ) )
        ),
        [Total Sales] >= MIN ( RangeTable[Min] )
            && [Total Sales] < MAX ( RangeTable[Max] )
    )
)

 

Total Sales for Group =
CALCULATE (
    SUM ( Sales[Sales] ),
    FILTER (
        ADDCOLUMNS (
            VALUES ( CustomerID[ID] ),
            "Total Sales", CALCULATE ( SUM ( Sales[Sales] ) )
        ),
        [Total Sales] >= MIN ( RangeTable[Min] )
            && [Total Sales] < MAX ( RangeTable[Max] )
    )
)

 I freehanded these and didn't test them, but they should be close.

View solution in original post

11 REPLIES 11

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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