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
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
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.