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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Trudgeon
Helper III
Helper III

List of Products sold to only one single Customer

I'm trying to get a list of products that were sold to a single customer.  I can easily attain an accurate list of products with a COUNT function by Customer that is filtered to "1".  However, once I bring in customer detail, the list blows up.  Any advice?Count.jpg

1 ACCEPTED SOLUTION

This link solved my problem:

https://stackoverflow.com/questions/50414271/creating-a-measure-that-returns-distinct-count-by-count...

 

The function I used:

CUSTOMER_COUNT_BY_PRODUCT = 
    CALCULATE(DISTINCTCOUNT(VIEW_SALES[CUSTOMER_CODE_SOLD]),
        ALLEXCEPT(VIEW_SALES, VIEW_SALES[MFC_PRODUCT_CODE],VIEW_SALES[TRANSACTION_DATE]))

 

View solution in original post

2 REPLIES 2
HotChilli
Super User
Super User

Adding in the Customer changes the context.  The table now shows a count of products where a customer has bought one (per customer).

This is how measures work, they adapt to the context in which they are evaluated.

You have options: re-write the measure to alter the context back to the original

or (depending on your model) put the customer in a separate visualisation (rather than add it to the table) and click the rows of the table.

 

Post your pbix here if you want someone to look at it

 

 

This link solved my problem:

https://stackoverflow.com/questions/50414271/creating-a-measure-that-returns-distinct-count-by-count...

 

The function I used:

CUSTOMER_COUNT_BY_PRODUCT = 
    CALCULATE(DISTINCTCOUNT(VIEW_SALES[CUSTOMER_CODE_SOLD]),
        ALLEXCEPT(VIEW_SALES, VIEW_SALES[MFC_PRODUCT_CODE],VIEW_SALES[TRANSACTION_DATE]))

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.