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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
CB2000
Regular Visitor

Show total sales in segment when selecting a customer

Hello,

 

 A have a fairly straight forward setup with a sales fact table,  dimension table customer segment, dimension table product category and a calendar table. I've created a page in Power BI with a filter on customer names. When you select a customer the total sales for the corresponding customer segment should show up in a table/matrix. Example, if I select customer "Dr Stockmann" I would like the table to show only customer category "Important" with corresponding value ( not filtered on the customer selection, but the total for the segment).

 

I've created a measure that shows the total for each segment, 

# Total sales segment =
CALCULATE (
[# Total Sales],
ALL ( T_Sales[Customer Name] )
)

But this shows the value of all segments and not only the segment for my selected customer. Any ideas how to do this?

Thanks!

 

 

CB2000_0-1681738638919.png

 

 

1 ACCEPTED SOLUTION

The main problem here is that you are placing a filter directly on the fact table. Ideally you would move the customer name column out of the sales table and into the customer table - customer number is already in there. You could then populate the slicer from the customer table  and create a measure similar to my original proposal.

I've replicated that behaviour by placing a slicer on 'T_CustomerCategory'[Customer no] and then using

# Total sales segment by cust no = CALCULATE (
    [# Total Sales],
    REMOVEFILTERS ( 'T_CustomerCategory' ),
    VALUES( 'T_CustomerCategory'[Category] )
)

This responds correctly to filters or slicers from any of the other dimensions.

View solution in original post

4 REPLIES 4
johnt75
Super User
Super User

Try

# Total sales segment =
CALCULATE (
    [# Total Sales],
    REMOVEFILTERS ( T_Sales ),
    VALUES ( T_CustomerCategory[Category] )
)

Hi,

 

Thanks for your help and suggestion. However it doesn't really solve my problem as it lists up all the different customer categories with total values. And also i'ts not possible to filter by date ( which, I must admit, was not specified in my initial post). I've uploaded a link to my file if that will make things a bit clearer. Thanks again.
File link: Customers and segments 

 

The main problem here is that you are placing a filter directly on the fact table. Ideally you would move the customer name column out of the sales table and into the customer table - customer number is already in there. You could then populate the slicer from the customer table  and create a measure similar to my original proposal.

I've replicated that behaviour by placing a slicer on 'T_CustomerCategory'[Customer no] and then using

# Total sales segment by cust no = CALCULATE (
    [# Total Sales],
    REMOVEFILTERS ( 'T_CustomerCategory' ),
    VALUES( 'T_CustomerCategory'[Category] )
)

This responds correctly to filters or slicers from any of the other dimensions.

Thank you - you're absoluetly right. That solved my problem. I'm still fairly new to DAX, and how the different "filters" work through the structure with multiple tables. Thanks again!

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.