Forum Discussion
Diogo_Dalla
4 years agoFrequent Visitor
Join with Clauses
Hi, I am looking for a way to merge two tables adding some clauses to the join. For example: Scrap Table: Order Step Quantity Scrapped Cost 1234 3 1 37 Order table: O...
- 4 years ago
Hi Diogo_Dalla ,
Please try the following measure or custom column(PQ).
Measure:
SumCost = SUMX ( SUMMARIZE ( Scrap, Scrap[Order], "_sum", CALCULATE ( SUM ( 'Order'[Cost] ), FILTER ( 'Order', 'Order'[Step] <= MAX ( Scrap[Step] ) && 'Order'[Order] = MAX ( 'Scrap'[Order] ) ) ) ), [_sum] )PQ Column:
JoinOrderCost = let myfunction = (CurrentOrder, CurrentStep) => let SelectRows = Table.SelectRows(Order, each [Order] = CurrentOrder and [Step] <= CurrentStep) in SelectRows, Data = List.Sum( myfunction([Order],[Step])[Cost]) in DataIf the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amirabedhiafi
4 years agoImpactful Individual