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...
daXtreme
Solution Sage
4 years ago# Intersecting Orders =
if( HASONEFILTER( Orders[Order] ),
var currentOrder = SELECTEDVALUE( Orders[Order] )
var RelevantProds = DISTINCT( Orders[Product] )
var relevantOrderCount =
CALCULATE(
DISTINCTCOUNT( Orders[Order] ),
Orders[Order] <> currentOrder,
RelevantProds,
ALL( Orders )
)
return
relevantOrderCount
)Without knowing what the model looks like it's difficult to give a definite answer to this question. Also, we don't know if choosing an order should run the calculation against all the orders or only some subset of them. The formula above runs it for all orders.