Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

FIFO Calculation with multiple products

AustinLeung
7 - Meteor

I am trying to calculate the cost of sales under First-in-first-out method. The cost could be calculated by excel, which is in column N in the "Results" file. However, I am not sure how I could use Alteryx to do the same thing.

 

Any help is much appreciated. Thanks in advance.

 

Cheers,

Austin

 

36 REPLIES 36
AustinLeung
7 - Meteor

@DavidP,

 

Thank you so much David! This approach is so easy to understand, especially to someone who is new to Alteryx.

 

I found a minor problem for this approach, when the transaction quantity is large, e.g. 1,000,000 units, it will take a longer time to generate the results.

 

But if the quantity is not large, this is definitely a perfect solution to calculate the FIFO cost of sales. Thanks again for your effort! I truly appreciate your help.

 

JoeS
Alteryx
Alteryx

@DavidP  I assume you meant to tag @JoeM  😉

DavidP
17 - Castor
17 - Castor

Correct, sorry @JoeS  so many Joe's...

JoeM
Alteryx Alumni (Retired)

I'll pass it on to the team! Thanks for getting it to one of the Joes!

Akyba_Lev
5 - Atom

@DavidP, thanks a lot!

The workflow is very helpful.

 

Could you please clarify one moment: what is "DateTimeDiff filter" for?

 

P.S: I tried to apply the workflow on my case, however, I guess, there is a problem with quantities with decimals. I tried to create rows with initialization expression 0.001, but it did not work out. Any ideas how to solve the problem?)

DavidP
17 - Castor
17 - Castor

@Akyba_Lev , the datetimediff filter is not really needed. 

 

This method is not designed with decimals in mind - if you can post some data and a description of what you'd like to achieve I can play around with it and see if I can help.

jvalcareng002
6 - Meteoroid

@reply_mueller - I've been searching these discussions for a solution to my FIFO problem, and your solution here seems to be the closest I could find to my case.

 

I have been trying to find a way to solve this without using an iterative macro since that is above my current experience, but since I am working with thousands of lines of data I think it will be the only way to solve. I was hoping you (or someone in this feed) would be able to advise. 

 

I have two tables with the following data a) Orders Created and b) Orders Received:

 

a) 

 

company_name_originalOrder Created DateOrders
Customer112/11/202010
Customer1011/6/20204
Customer1012/8/20206
Customer1012/10/20204
Customer1012/11/202050
Customer1012/14/202025
Customer1012/23/202035
Customer101/14/20215
Customer10012/9/20205

 

 

b)

 

company_name_originalOrder Received DateOrders Received
Customer112/28/20201
Customer1012/8/20204
Customer1012/11/20201
Customer1012/12/20204
Customer1012/24/20201
Customer101/11/20211
Customer101/13/20211
Customer10012/14/20202
Customer10012/15/20203

 

I would like the result to look something like the table below, where orders received is matched to orders created on a first in first out basis. That is orders received are shown to come from the first order placed up until the total # order amount. Once the initial order amount is exceeded, the orders received come from the next order created, and so on and so forth. For example, if Customer 1 orders 10 units on Jan-1 and 10 units on Jan-2, then when they receive 15 units on Jan-3, 10 of those units will be from the order created Jan-1 and 5 will be from the order created Jan-2. The remaining orders received are then attributed accordingly up until the total order amount for each order created.

 

Result:

 

company_name_originalOrder Received DateOrders ReceivedOrder Created Date
Customer112/28/2020112/11/2020
Customer1012/8/2020411/6/2020
Customer1012/11/2020112/8/2020
Customer1012/12/2020412/8/2020
Customer1012/24/2020112/8/2020
Customer101/11/2021112/10/2020
Customer101/13/2021112/10/2020
Customer10012/14/2020212/9/2020
Customer10012/15/2020312/9/2020

 

 

Due to the large data set, I have looked into grouping the orders by week created / week received rather than exact date. I have attached the sample data below and would appreciate any help you can offer. My biggest issue has been splitting the amount of the order received between several created orders when the amount received exceeds the total amount available in the previous order (i.e. as explained in the example above).

 

Thanks,

 

Juliana

Labels