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
Laila92
Helper V
Helper V

Find products that customer did not buy

I have three tables:
1. A product table

2. A sales table

3. A customer table

(see here for data https://docs.google.com/spreadsheets/d/1v0ONqPxPZdvVKtocFyvhG-NSJy3rPHXDGkCea_T6hzE/edit#gid=8994835... )

I am trying to achieve:
Show which products a customer did NOT buy.  With the dax below I did manage to make a table doing exactly that, but I am not managing to establish a relationship between the product and sales table. Only between the product and customer table. How can have the sales data and the data from the EXCEPT table in one table?

 

 

 

 

Total Org Pot. MRR =
var all_products = CROSSJOIN(
CALCULATETABLE(
DISTINCT(Deals[Organization ID]),
FILTER(deals,Deals[Customer Status]="Won"),
FILTER(deals,Deals[Status]<>"Open")
),
FILTER(
DISTINCT(Deals_Product_Lookup[Product Id]),
Deals_Product_Lookup[Product Id]=2||Deals_Product_Lookup[Product Id]=3||Deals_Product_Lookup[Product Id]=16||Deals_Product_Lookup
[Product Id]=6||Deals_Product_Lookup[Product Id]=8))
var products_won_orgs = SUMMARIZE(FILTER(deals,Deals[Status]="Won"),Deals[Organization ID],Deals[Product Id])

RETURN

EXCEPT(all_products,products_won_orgs)

 

 

 

 

3 REPLIES 3
v-xuding-msft
Community Support
Community Support

Hi @Laila92 ,

 

I'm not clear about your formula. Do you want a table? Does "Deals" mean "sales table" and "Deals_Product_Lookup" mean "product table"? If so, there is a "product id" column and you could create a relationship between the table and "sales table". I don't know what your actual tables look like.

 

If you want a measure, you could refrence this to have a try.

Measure =
CALCULATE (
    MAX ( 'product table'[Product Id] ),
    FILTER (
        'product table',
        NOT ( 'product table'[Product Id] IN ALLSELECTED ( 'sales table'[Product Id] ) )
    )
)

 

If this can't help you, please share your expected output. We will understand more clearly.

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@Laila92 , Try to create a sales measure with +0

 

and then filter on 0.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak a measure calculating what?

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!

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.