Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi, I am trying to "assign" pending orders to batches based on FIFO. I have 2 tables:
tblSKU
tblPendingOrders
I want to add a column to tblSKU showing pending orders. So, with the current pending orders, tblSKU would look like this:
Looking for the best way to accomplish this with DAX. Thx!
Solved! Go to Solution.
Hi @JaviGoldstein ,
Here us my test data:
Create a calculate column
Pending Orders =
VAR tblPO =
CALCULATE(
MAX(tblPendingOrders[Amount]),
FILTER(
tblPendingOrders,
tblPendingOrders[SKU] = tblSKU[SKU]
)
)
VAR temp_result =
IF(
(tblPO-tblSKU[Balance]) >= 0,
tblPO-tblSKU[Balance],
0
)
RETURN
IF(
(temp_result - tblSKU[Balance]) > 0,
temp_result - tblSKU[Balance],
IF(
tblPO > tblSKU[Balance],
IF(
tblSKU[Batch] = 1,
tblSKU[Balance],
temp_result
),
temp_result
)
)
Final output
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @JaviGoldstein ,
Here us my test data:
Create a calculate column
Pending Orders =
VAR tblPO =
CALCULATE(
MAX(tblPendingOrders[Amount]),
FILTER(
tblPendingOrders,
tblPendingOrders[SKU] = tblSKU[SKU]
)
)
VAR temp_result =
IF(
(tblPO-tblSKU[Balance]) >= 0,
tblPO-tblSKU[Balance],
0
)
RETURN
IF(
(temp_result - tblSKU[Balance]) > 0,
temp_result - tblSKU[Balance],
IF(
tblPO > tblSKU[Balance],
IF(
tblSKU[Batch] = 1,
tblSKU[Balance],
temp_result
),
temp_result
)
)
Final output
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@Anonymous this is perfect. THANKS!
Please use a proper logistics planning tool. Power BI has no memory and is incapable of handling material allocation tasks. Its focus is on reporting data.
not using this as a logistics solution. Reporting only.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
10 | |
10 | |
9 | |
9 |
User | Count |
---|---|
20 | |
13 | |
12 | |
11 | |
8 |