Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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 to allow the slicer filter on both tables by branch?
Solved! Go to Solution.
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.
Create another table with just the Branch values, either in the query editor by referencing one of your existing tables, or with a DAX table with DISTINCT(Orders[Branch]) for example. You can then relate the new table to both columns on the Branch columns.
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi Pat,
Thanks for your reply. I have tried this method before, but I couldn't get the correct number on allocation Qty.
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.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.