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.
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