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
KeithChu
Helper I
Helper I

Find Sales Order that contains Item A,B and C

Dear experts,

 

I would like to find Sales Order that contains Item A, B and C, preferably using a slicer to click instead of hard coding the Item in the expression. Could you give me a starting point to look for?

 

https://www.daxpatterns.com/basket-analysis/#complete-pattern

 

I have looked into Basket Analysis and have tried out myself using the AdventureWorks database. I was able to create the measure and graph I needed. However I didn't know what to do when the condition has more than 2 product. 

 

Any help/direction would be great. Thank you.

1 ACCEPTED SOLUTION
KeithChu
Helper I
Helper I

ok I found a way to do it. I have to think it as a SQL query.

 

https://stackoverflow.com/questions/25614699/sql-select-from-header-table-where-detail-table-rows-ha...

 

SO contain Filter Product = 
IF(
    CALCULATE(
        COUNTROWS('Sales SalesOrderDetail'),
        CALCULATETABLE(SUMMARIZE('Sales SalesOrderDetail', 'Sales SalesOrderDetail'[ProductID]),USERELATIONSHIP('Sales SalesOrderDetail'[ProductID], 'Filter Product'[ProductID]))
    ) = [Selected Filter Product], TRUE, FALSE)

View solution in original post

2 REPLIES 2
KeithChu
Helper I
Helper I

ok I found a way to do it. I have to think it as a SQL query.

 

https://stackoverflow.com/questions/25614699/sql-select-from-header-table-where-detail-table-rows-ha...

 

SO contain Filter Product = 
IF(
    CALCULATE(
        COUNTROWS('Sales SalesOrderDetail'),
        CALCULATETABLE(SUMMARIZE('Sales SalesOrderDetail', 'Sales SalesOrderDetail'[ProductID]),USERELATIONSHIP('Sales SalesOrderDetail'[ProductID], 'Filter Product'[ProductID]))
    ) = [Selected Filter Product], TRUE, FALSE)
Floriankx
Solution Sage
Solution Sage

If you have only one table with no relations you can just create a measure of all data.

If you slice your data by item or others Power BI can handle this and only the value for the sliced data is shown.

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.