Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Solved! Go to Solution.
Try it using EXCEPT
Customerbuyingmilkthisweek =
VAR Customerlistmilk =
CALCULATETABLE (
VALUES ( 'Distinctcustomer'[LocationReference] ),
'Weekly Data'[Weeknum] = MAX ( 'Weekly Data'[Weeknum] ),
'Weekly Data'[Product Catagory1_3] = "Milk"
)
VAR Customerlistother =
CALCULATETABLE (
VALUES ( 'Distinctcustomer'[LocationReference] ),
'Weekly Data'[Weeknum] = MAX ( 'Weekly Data'[Weeknum] ),
'Weekly Data'[Product Catagory1_3] IN { "Bread", "Groceries", "Creams" }
)
VAR CustomerMilkOnly =
EXCEPT ( Customerlistmilk, Customerlistother )
RETURN
COUNTROWS ( CustomerMilkOnly )
I think the problem with your original was in the NOT IN section. You used () instead of {} and the NOT was a bit off.
Customerbuyingmilkthisweek =
VAR Customerlistmilk =
CALCULATETABLE (
VALUES ( 'Distinctcustomer'[LocationReference] ),
'Weekly Data'[Weeknum] = MAX ( 'Weekly Data'[Weeknum] ),
'Weekly Data'[Product Catagory1_3] = "Milk"
)
VAR Customerlistother =
CALCULATETABLE (
VALUES ( 'Distinctcustomer'[LocationReference] ),
'Weekly Data'[Weeknum] = MAX ( 'Weekly Data'[Weeknum] ),
'Weekly Data'[Product Catagory1_3] IN { "Bread", "Groceries", "Creams" }
)
RETURN
COUNTROWS (
FILTER ( Customerlistmilk, NOT ( Customerlistmilk ) IN { Customerlistother } )
)
Still unable to understand why countrown is resturning multiple values when this return scalar. However except works really good! Thanks
Try it using EXCEPT
Customerbuyingmilkthisweek =
VAR Customerlistmilk =
CALCULATETABLE (
VALUES ( 'Distinctcustomer'[LocationReference] ),
'Weekly Data'[Weeknum] = MAX ( 'Weekly Data'[Weeknum] ),
'Weekly Data'[Product Catagory1_3] = "Milk"
)
VAR Customerlistother =
CALCULATETABLE (
VALUES ( 'Distinctcustomer'[LocationReference] ),
'Weekly Data'[Weeknum] = MAX ( 'Weekly Data'[Weeknum] ),
'Weekly Data'[Product Catagory1_3] IN { "Bread", "Groceries", "Creams" }
)
VAR CustomerMilkOnly =
EXCEPT ( Customerlistmilk, Customerlistother )
RETURN
COUNTROWS ( CustomerMilkOnly )