Forum Discussion
2 Step Filter on dimension approach
- Anonymous2 years ago
Hi SnoekL
For your question, here is the method I provided:
I used the data you provided
“FACT Orderlines”
Create a measure. Query all orders that contain the selected product.
Select_Product-Amount = var select_product = IF( ISFILTERED('ProductDim'[Name]), VALUES('ProductDim'[ID]), BLANK() ) var select_product_amount = SUMX( FILTER( 'FACT Orderlines', CALCULATE( CONTAINS( 'FACT Orderlines', 'FACT Orderlines'[ProductID], select_product ), ALLEXCEPT( 'FACT Orderlines', 'FACT Orderlines'[OrderID] ) ) ), 'FACT Orderlines'[Amount] ) RETURN select_product_amountCreate a measure. Group and sum the product.
Product_amount = SUMX( FILTER( ALL('FACT Orderlines'), 'FACT Orderlines'[ProductID] = MAX('FACT Orderlines'[ProductID]) ), [Select_Product-Amount] )Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi SnoekL
For your question, here is the method I provided:
I used the data you provided
“FACT Orderlines”
Create a measure. Query all orders that contain the selected product.
Select_Product-Amount =
var select_product =
IF(
ISFILTERED('ProductDim'[Name]),
VALUES('ProductDim'[ID]),
BLANK()
)
var select_product_amount =
SUMX(
FILTER(
'FACT Orderlines',
CALCULATE(
CONTAINS(
'FACT Orderlines',
'FACT Orderlines'[ProductID],
select_product
),
ALLEXCEPT(
'FACT Orderlines',
'FACT Orderlines'[OrderID]
)
)
),
'FACT Orderlines'[Amount]
)
RETURN select_product_amount
Create a measure. Group and sum the product.
Product_amount =
SUMX(
FILTER(
ALL('FACT Orderlines'),
'FACT Orderlines'[ProductID] = MAX('FACT Orderlines'[ProductID])
),
[Select_Product-Amount]
)
Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.