Forum Discussion
cdawidow2
4 years agoFrequent Visitor
FIND ORDERS WITH SAME PRODUCTS
Hi guys, I want to create a simple measure that would simply count all the orders that share at least 1 of the same products of a selected order. For example. When I choose ORDER 2 which conta...
cdawidow2
4 years agoFrequent Visitor
This works thank you ! Out of curiosity, is there a way to modify the above formula to take into account all selected products ?
So in order to get a count, the order must contain all the same products as the selected order
johnt75
Super User
4 years agoThis might have performance issues if you have a lot of orders, but in principle you could try
Orders matching all products =
var thisOrdersProducts = VALUES( Orders[Product ID])
var result = SUMX( ALL(Orders),
var currentOrderProducts = VALUES( Orders[Product ID])
return IF( ISEMPTY( EXCEPT( thisOrdersProducts, currentOrderProducts) ), 1, 0 )
)
return result