Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!See when key Fabric features will launch and what’s already live, all in one place and always up to date. Explore the new Fabric roadmap
08-06-2021 07:23 AM - last edited 08-16-2021 12:20 PM
Basically, given an order table with multiple items sold per order, figure out how many times combinations of items were sold together. OK, so technically this is a table, not a measure...
Table 2 =
VAR __Table =
DISTINCT(
FILTER(
GENERATE(
SELECTCOLUMNS(DISTINCT('Table'[Item_Name]),"Item_Name_1",[Item_Name]),
SELECTCOLUMNS(DISTINCT('Table'[Item_Name]),"Item_Name_2",[Item_Name])
),
[Item_Name_1]<>[Item_Name_2])
)
VAR __Table2 =
ADDCOLUMNS(
__Table,
"Bought Together",
VAR __t1 = SUMMARIZE(FILTER('Table',[Item_Name] = [Item_Name_1] || [Item_Name] = [Item_Name_2]),[Order_ID],"__Count",COUNTROWS('Table'))
RETURN
COUNTROWS(FILTER(__t1,[__Count]>1))+0
)
RETURN
__Table2
eyJrIjoiMDM2ZGIyOTAtZThhMS00MTQ4LWI1MTAtMWFiZGVkOTgyMDMwIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9