cancel
Showing results for
Did you mean:

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

New Member

FIFO question

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!

1 ACCEPTED SOLUTION
Community Support

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

4 REPLIES 4
Community Support

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

New Member

@v-heq-msft this is perfect.   THANKS!

Super User

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.

New Member

not using this as a logistics solution.   Reporting only.

Announcements

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors