purchasing in killos and selling in length? how to measure cost algo? - erp

I am stuck in a situation where I need to come up with an effective way to calculate cost of pipes which is bought in KG and is sold in length and record cost for profit calculation in accounts..
things to consider:
Even if i weight the pipes in feet and meter and add conversion quantities it wont work... because the material used in manufacturing varies sometimes there is e.g. 1000ft in 50 kg and sometimes there is 1150ft in the same weight..
The bundles purchased are sometimes of 52kg, 49kg and 50kg.
Ideas:
(a. i could purchase in unit... and sell in feet and have a customization where after every order i have an option to mark the end of product.. and when i mark the end of the product the purchase cost i.e. $1000 can be divided by the length sold... but issue is it might take a week to sell the product, so it wont show accurate profit at end of day alterntively i can have an approximate cost and have it replaced once the item has ended? thats the best i can come up with. The con of this is what if its time for closing accounts of the year and only half of the bundle has been sold?
what would be the most accurate way of handing this logic in any ERP? POS? The reason i tagged Magento, SAP because i am curious how Magento and SAP handles this situation?
I am feeling accountants and accounts and finance related guys can also chip in, so I am adding the accounting tag

You need to have different UoM for this kind of Item.
Purchasing UoM, Inventory UoM, and Sales UoM. I will consider the Inventory and Sales UoM as the same.
Pipe_A001:
Purchase = Kg |
Inventory = meter |
Sales = meter
So, the challenge is to have the measurement in your Inventory UoM then get the price cost, and you need to take into account when you actually receive against the cost they charge in the Invoice.
Ex: you buy on Aug 1, your PO is 50 Kg # $ 10/Kg, so it Cost you $ 500. Receive actually 49 Kg, but they still charge you for the PO amount which is $ 500.
The 49 Kg is not relevant anymore, since you own the item and you will convert to your measurement which is meter. Let's say you measure and it's 320 meter, so the cost per meter is $ 500 / 320m = $ 1.5625/m.
The next batch on Aug 15, you buy another 50 Kg at the same price. Receive 51 Kg, Invoiced $ 500, Length measured 350m. So now you will have the new batch price which is $ 500 / 350m = $ 1.4285/m.
What matters is not the Kg received, but the cost the Supplier Invoiced and the measurement in your Inventory UoM. You might have an agreement with Supplier that they charge only the weight measured at your receiving point.
From this point, it is back to your procedure whether to count as FIFO with different batch or count as Moving Average.

Related

Google Sheets: How to weigh two different numbers and rank them

I am trying to make a spreadsheet for a beer tasting/comparison event.
I have a column with price pr. liter and a column with tasting scores from the participants, and I'd like to make a column where I calculate "best" beer based on the score, and also factor in the price - for example the score (0-50 points pr. beer) is of 80% "importance" and the price pr. liter (from around 33 USD to 12 USD) weighs 20%. Is this possible?
I haven't been able to figure out a solution to this at all. I have a hard time "mapping" it out in my head.

Change the delay from 20 to 1 minutes

Quotes are not sourced from all markets and may be delayed up to 20
minutes. Information is provided 'as is' and solely for informational
purposes, not for trading purposes or advice.
This advice appears when I use GOOGLEFINANCE() function in my spreadsheet. It is unfortunate that the data is delayed up to 20 minutes.
What is the best way to get real-time stock prices? Suppose my budget is around $50 per month.
Be aware that I trade only US equities, i.e. no bonds, no cryptocurrencies, and so on.
UPDATE
Here is a sample version of my portfolio spreadsheet : https://docs.google.com/spreadsheets/d/1hIfCuupmc_OZ6514DXFe_NrDCX1Ix6tcvySP_VolppI/edit#gid=42667785. It would be important for me to get the price in real-time, and not delayed by maximum 20 minutes.
Is there a way to fix that?
The GOOGLEFINANCE formula is not consistent with the delays. Different stocks can be delayed by different times. You can get an estimate of the delay by using GOOGLEFINANCE("TICKER","DATADELAY").
This is at least somewhat helpful, but not ideal, because you'll have a price on your sheet and you don't know exactly when the price was from, just an estimate of how old the price might be. And forget about pre-market or after-hours. Once the market closes, all bets are off you'll have no idea when the price is from (i.e. after hours quote or regular session close).
If you want accurate real-time quotes, you're going to need an add-on. You said your budget is $50. That doesn't leave you a lot of options. For $9 per month you can use the Market Data Add-on and get real-time stock prices along with historical intraday prices. There is also a free tier that gives you 100 free daily prices.
Market Data's STOCKDATA formula is a drop-in replacement for GOOGLEFINANCE, so it follows the same syntax. It will accomplish what you need. For example, STOCKDATA("SPY","ALL") will produce an output like this:
Date
Bid
Bid Size
Mid
Ask
Ask Size
Last
Volume
5/19/2022 9:09:48
388.36
1400
388.38
388.41
1400
388.37
2715229
Note that the date and time of the quote is included in the output, so you know exactly when the quote was fetched. There is no doubt as to whether the quote is coming from the previous day or whether it is a quote from the pre-market session (which is the case of this example). If you compare to the current time using NOW(), you'll find the Market Data quotes are delayed by about 1-2 seconds, which is due to network latency from your Google Sheet to the servers.
it's important to notice the word "may" in the first sentence:
...and may be delayed up to 20 minutes...
usually, it's way under 20 minutes (around 1 - 1:30 minutes), but there could be times when some delay may occur.
and to answer your question: no, it's not possible to force it under 1 minute
if you want to go full pro mode with Google Sheets then try: =CRYPTOFINANCE()
The documentation links from player0 indicate that ONLY crypto exchanges are supported. Data is NOT available from stock exchanges (NASDAQ, NYSE, etc).

Click revenue prediction model

I'm trying to build a model for eCommerce that would predict revenue for single click that comes via online-marketing channels (e.g. google shopping). Clicks are aimed for product detail pages so my training data consists of product details like: price, delivery time, category, manufacturer. Every historical click also has attached revenue to it. The problem is that revenue equals zero for more that 95% of clicks.
Historical data would look like this:
click_id | manufacturer | category | delivery_time | price | revenue
1 |man1 | cat1 | 24 | 100 | 0
2 |man1 | cat1 | 24 | 100 | 0
3 |man1 | cat1 | 24 | 100 | 0
4 |man1 | cat1 | 24 | 100 | 120
5 |man2 | cat2 | 48 | 200 | 0
As you can see, it's possible (and common) that two data points have exactly same features and very different value of target variable (revenue). e.g first 4 data points have the same features and and only 4th has revenue. Ideally, my model would on test example with same features predict average revenue for those 4 clicks (which is 30).
My question is about data representation before I try to apply model. I believe I have two choices:
Apply regression directly to click data (like in case above) and hope that regression would do the right thing. In this case regression error would be pretty big on the end so it would be hard to tell how good the model actually is.
Try to group multiple data points (clicks) to one single point to avoid some zeros - group all data points that have the same features and calculate target (revenue) variable as SUM(revenue)/COUNT(clicks). With this approach I still have a lot of zeroes in revenue (products that got only few clicks) and sometimes there will be thousands of clicks that give you only one data point - which doesn't seem right.
Any advice how to proceed with this problem is very welcomed.
With 95% of your data having zero revenue, you may need to do something about the records, such as sampling. As currently constructed, your model could predict "no" 100% of the time and still be 95% accurate. You need to make a design choice about what type of error you'd like to have in your model. Would you like it to be "as accurate as possible", in that it misses the fewest possible records, to miss as few revenue records as possible, or avoid incorrectly classifying records as as revenue if they actually aren't (Read more on Type 1 & 2 error if you're curious)
There are a couple high level choices you could make:
1) You could over-sample your data. If you have a lot of records and want to make certain that you capture the revenue generating features, you can either duplicate those records or do some record engineering to create "fake" records that are very similar to those that generate revenue. This will increase the likelihood that your model catches on to what is driving revenue, and will make it overly likely to value those features when you apply it to real data
2) You could use a model to predict probabilities, and then scale your probabilities. For example, you may look at your model and say that anything with greater then 25% likelihood of being revenue generating as actually a "positive" case
3) You can try and cluster the data first, as you mentioned above, and try and run a classification algorithm on the "summed" values, rather than the individual records.
4) Are there some segments that hit with >5% likelihood? Maybe build a model on those subsets.
These are all model design choices and there is no right/wrong answer - it just depends on what you are trying to accomplish.
Edited per your response
Regression can be significantly impacted by outliers, so I would be a bit careful just trying to use a regression to predict the dollar amounts. It's very likely that the majority of your variables will have small coefficients, and the intercept will reflect the average spend. The other thing you should keep in mind are the interaction terms. For example, you may be more likely to buy if you're male, and more likely if you're age 25-30, but being BOTH male and 25-30 has an outsized effect.
The reason I brought up classification was you could try and do a classification to see who is likely to buy, and then afterwards apply dollar amounts. That approach would prevent you from having essentially the same very small amount for every transaction.

Prepping Data For Usage Clustering

Dataset: I'm given the number of minutes individual customers use a product each day and am trying to cluster this data in order to find common usage patterns.
My question: How can I format the data so that, for example, a power user with high levels of use for a year looks the same as a different power user who has only been able to use the device for a month before I ended data collection?
So far I've turned each customer into an array where each cell is the number of minutes used that day. This array starts when the user first uses the product and ends after the user's first year of use. All entries in the cells must be double values (e.x. 200.0 minutes used) for the clustering model. I've considered either setting all cells/days after the last day of data collection to either -1.0 or NULL. Are either of these a valid approach? If not what would you suggest?
For the problem where you want both users (one that used the product a lot every day for a year, and the other used it a lot for one month), create a new entry where it's values are:
avg_usage per time_bin
time_bin can be a month, a day or another time bin which best fits your needs.
This way, a user which use a product, let's say 200 minutes per day for one year, will get:
200 * 30 * 12 / 12 = 6000 minutes per month
and the other user, which joined just last month, will also get, with the exact same usage will get:
200 * 30 * 1 / 1 = 6000 minutes per month.
This way, it doesn't matter when you have started to use the product, the only thing that matter, is the usage rate.
An important thing you might take into consideration, that products, may be forgotten for some time. for example, a computer, and I'm away for a vacation. Those days I didn't use my computer, doesn't have (maybe) an effect of my general usage of this product. So, based on your data, product and intuition you might consider removing gaps like the one I mentioned, and not take it into account inside the calculation.
The amount of time a user has used your product could be a signal of something, but if indeed he only started some time ago, and still using it until today, it may be something you need to take into consideration, and for that use, this average binning technique may help.

How to sum up different currencies in Rails app?

I am currently building a Ruby on Rails invoicing application that is multilingual and supports a range of currencies. In the dashboard view all invoices a user has produced are totalled.
Now it would be nice if a user could choose the currency for each invoice.
But how can those invoices be totalled if different currencies are used?
E.g. if these three invoices were created today:
Invoice No. 1: $1000.00
Invoice No. 2: $2000.00
Invoice No. 3: €1000.00
Total: $4333.60
----------------------
The dollar-euro exchange rate would have to be based on each invoice's date of course.
How can this be achieved in Rails and does it even make sense?
Thanks for any pointers.
The sum of of multiple invoices using different currencies is not a single number, it's a collection of numbers. If you have a 20 USD invoice, a 15 EUR invoice, and a 20 EUR invoice, the sum is "20 USD + 35 EUR".
At the time when a payment is made from a single account using a single base currency, then a conversion will be performed to determine how much will have to be paid in that currency to cover the total converted costs. Presumably, there will also be currency conversion fees added at that time.
It would be convenient if you change the currency to a single one, either euro or dollar right when the user makes an invoice. That is, you save the 'converted' value in your database. In this way you won't have to lookup for past day rates.
Eu_central_bank provides exchange rates.

Resources