Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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!
Solved! Go to 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.
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!
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
11 | |
10 | |
6 |