Hi
I came across this piece of code for calculating how many of a 2nd product are bought with a first product. PLU is the code for the 1st product and Filter-PLU the same codes for the 2nd product
CALCULATE (
DISTINCTCOUNT(Transactions[TransID]),
CALCULATETABLE (
SUMMARIZE ( Transactions,Transactions[TransID] ),
ALL ( PLU ),
USERELATIONSHIP ( Transactions[PLU], Filter_PLU[Filter PLU] )
)
)
This works perfectly. I've now been asked about baskets of 3 products so select product 1, select product 2 and see what number of transaction have product 3 in them as well. So I'm guessing there is a way to nest the above calculation by creating 3 rd list of codes Filter2_PLU, creating an inactive relationship between Filter_PLU and Filter2_PLU.
Since i pinched the code it isn't obvious to me how i nest it as clearly have create some table using the Filer and Filter2 to feed into the top calculation. If any one smart than me has a suggestion that would be much appreciated.
Mike
I came across this piece of code for calculating how many of a 2nd product are bought with a first product. PLU is the code for the 1st product and Filter-PLU the same codes for the 2nd product
CALCULATE (
DISTINCTCOUNT(Transactions[TransID]),
CALCULATETABLE (
SUMMARIZE ( Transactions,Transactions[TransID] ),
ALL ( PLU ),
USERELATIONSHIP ( Transactions[PLU], Filter_PLU[Filter PLU] )
)
)
This works perfectly. I've now been asked about baskets of 3 products so select product 1, select product 2 and see what number of transaction have product 3 in them as well. So I'm guessing there is a way to nest the above calculation by creating 3 rd list of codes Filter2_PLU, creating an inactive relationship between Filter_PLU and Filter2_PLU.
Since i pinched the code it isn't obvious to me how i nest it as clearly have create some table using the Filer and Filter2 to feed into the top calculation. If any one smart than me has a suggestion that would be much appreciated.
Mike