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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register 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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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