Forum Discussion
Anonymous
4 years agoNot applicable
How do I create the relationships
Hi, I am new to PowerBi and currently stuck on the relationship between the tables below. Orders Stock Allocation Power Bi Desktop How to create the relationship...
- 4 years ago
Hi Anonymous
You can try this,
(1) Create the auxiliary tables
Table = DISTINCT( SELECTCOLUMNS(Orders,"Sales Date",Orders[Sales Date],"Order",Orders[Order]))(2) create the measures below,
Qty = CALCULATE ( SUM ( Orders[Qty] ), FILTER ( ALL ( Orders ), Orders[Branch] = SELECTEDVALUE ( 'Branch Filter'[Branch] ) && Orders[Sales Date] = MIN ( 'Table'[Sales Date] ) && Orders[Order] = MIN ( 'Table'[Order] ) ) )Allocation = CALCULATE ( SUM ( 'Stock Allocation'[Qty] ), FILTER ( ALL ( 'Stock Allocation' ), 'Stock Allocation'[Branch] = SELECTEDVALUE ( 'Branch Filter'[Branch] ) && 'Stock Allocation'[Sales Date] = MIN ( 'Table'[Sales Date] ) && 'Stock Allocation'[Order] = MIN ( 'Table'[Order] ) ) )result
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
4 years agoNot applicable
Hi Pat,
Thanks for your reply. I have tried this method before, but I couldn't get the correct number on allocation Qty.
v-xiaotang
4 years agoCommunity Support
Hi Anonymous
You can try this,
(1) Create the auxiliary tables
Table = DISTINCT( SELECTCOLUMNS(Orders,"Sales Date",Orders[Sales Date],"Order",Orders[Order]))
(2) create the measures below,
Qty =
CALCULATE (
SUM ( Orders[Qty] ),
FILTER (
ALL ( Orders ),
Orders[Branch] = SELECTEDVALUE ( 'Branch Filter'[Branch] )
&& Orders[Sales Date] = MIN ( 'Table'[Sales Date] )
&& Orders[Order] = MIN ( 'Table'[Order] )
)
)Allocation =
CALCULATE (
SUM ( 'Stock Allocation'[Qty] ),
FILTER (
ALL ( 'Stock Allocation' ),
'Stock Allocation'[Branch] = SELECTEDVALUE ( 'Branch Filter'[Branch] )
&& 'Stock Allocation'[Sales Date] = MIN ( 'Table'[Sales Date] )
&& 'Stock Allocation'[Order] = MIN ( 'Table'[Order] )
)
)
result
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.