OK, @jbressan got in quicker, but because it’s always valuable to see how different people addressed the same problem, here’s my solution. I used a disconnected table slicer on Item # (and instead of a standard slicer, I used the custom SmartFilter Pro - a custom visual I really like that handles this sort of data really well IMO). Then, here’s the measure that does most of the heavy lifting:
Customers Who Bought =
//Filters the Sales Table Down to Purchases of the Selected Items
VAR CustTable =
CALCULATETABLE(
'Posted Sales Transactions',
FILTER( 'Posted Sales Transactions',
[Bought Item] = 1
)
)
//Creates a 1-Column Table from CustTable of Customers Who Purchased
// One or More of the Selected Items
VAR CustList =
SELECTCOLUMNS(
CustTable,
"@customers", 'Posted Sales Transactions'[Sell-to Customer No]
)
//If the Selected Customer in the Sales Table is in the list of Customers
//who purchased the selected item(s), measure gets a 1, otherwise gets 0
VAR CustInCustList =
IF(
SELECTEDVALUE( 'Posted Sales Transactions'[Sell-to Customer No] ) IN CustList,
1,
0
)
RETURN
CustInCustList
And here’s how it looks all put together:
I hopt this is helpful. Full solution file posted below.
- Brian
eDNA Forum - Selected Item Basket Solution.pbix (1.1 MB)