How to Get the Monthly Sales Prediction for next year using the sales history records of past 5 years? - data-mining

I need to develop a system where user can analyse the past sales records and can predict monthly sales for next year. There I am using simple linear regression and get the past monthly sales records of past 5 years and create a line chart.
X= month
y= sales
e.g. I get the sales of month January for 5 years and get the average and plot the graph for 12 months. So how could I give user to predict for monthly sales for next year based on the graph of linear regression equation?
Also I would like to know whether my approach is correct? or are there any efficient ways to do that?
thanks

Welcome to forecasting. Your question doesn't quite belong here (as MBaas points out, stackoverflow is about teh codez), but while you are here you might as well get started with an excellent book, free and online, Rob Hyndman's Forecasting: principles and practice.
https://www.otexts.org/fpp
Once you have a code-related forecasting question, stackoverflow is the place for it! Hyndman even answers an occasional question here.

Related

Aggregate and Calculate Percentiles in Powerbi

Firstly thank you for any help anyone can provide on this one.
I need to be able to
Calculate Percentiles for bed-days at the top-level grouped by months and quarters.
Be able to slice on other fields and have the percentiles recalculated.
To allow for a tabulated output akin to what is produced in a box plot.
(other summary metrics will be going alongside)
Sample Data
This should return a total of bed days to be fed into the percentile for 12 days on 01/04/2021 and 19 days for 02/04/2021 or 6 and 11 days if I sliced on cardiology.
Thanks again.
Joe

Rolling Average Prediciton for Future 30 Days in DAX

I am working on a forecasting graph that will be pulling in data from SQL through power query. The graph will have slicers and filters available to the user to analyze different populations. I am currently being asked to provide a rolling average for each day of the next month but will update daily as more data becomes available. I need 30 days of rolling average that occur after the current date. Using the prior days rolling average calculation. This has to be completed in dax to allow the filters and slicers to work appropriately. The rolling average looks 14 days back.
Any ideas on how to best proceed would be greatly appreciated.
Below is a table of data to show how this looks in excel:

Cumulative/Rolling Sum Blank Dates

I'm currently working on inventory reconciliation, and I've struggling to fill all days of the calendar with the cumulative sum of product we're currently storing:
Inventory level ($). = CALCULATE(SUM(ledger[cost]),FILTER(ALL(DimDate[Date]),DimDate[Date]<=MAX(ledger[Document Date])))
As you guys might notice it has at least 90% of all dates filled, however if we look closely to the graph, we can appreaciate March 5th of 2016 is missing just due to the fact there was no transaction during that day resulting on a blank value. However I'm trying to accomplish retrieving the previous day balance for those days with no transactions. e.g: for March 5th should have $17,038,462.32 (balance for the previous day March 4th).
I'm trying to work on another clause into the measure with functions such as EARLIER or LASTDATE, however I haven't been succesful.
Any insight or solutions works well thank you. Have a nice day.
You are using a wrong date field in your measure. Change it to the field from the Date table:
Inventory level. =
CALCULATE(
SUM(ledger[cost]),
FILTER(ALL(DimDate[Date]),DimDate[Date]<=MAX(DimDate[Date])))

Open Office find all bills labelled POWER and work average cost

So I have made a spreedsheet to help me keep track of my power and gas bill - well the total cost of the bill anyway. This way as the months go on I am able to see what the average Power and Gas bill have been.
I am using only sheet1 and prefer to do it this way, so when I show my partner they don't need to flick through pages of numbers. It's right in front of them with Power & Gas in the next row - take a look at the image below.
So as you can see from the above (not including the J3 row) I have everything laid out in the layout I would like. This way when I get a bill emailed to me I add it, and then I can pay X amount and record that.
I know how to do =sum() and =average() but how can I limit it to only the power rows automatically.
The query should be looking up G column for power or gas and then whichever one it is get the H column next to it and then work out the cost per month by looking at the date the bill came out.
Power bill is every month so that easy, gas is every 3 months.
I know in open office they have the =if() command and I made it return TRUE when it was power but it does not seem that i can use just that function? I am wondering if maybe a TUT or example that outlines how we get the result like this.
Another example would be replace gas and power with tech toys i.e batteries over a year what was the real cost per monthly.
Ok after thinking outside the square - the answer I am using is this.
=AVERAGEIF(G3:G100;"POWER";H3:H100)/COUNTIF(G3:G100;"POWER")
I divided power by it's count as we get it every month
=AVERAGEIF(G3:G100;"GAS";H3:H100)/COUNTIF(G3:G100;"GAS")/3
I divided gas by 3 as we get it every 3rd month

What is KSP date formatting?

I am dealing with a dataset and I have to deal with the date formatting. I need to know different ways I can use this dates feature to predict the data.
Thanks
There are different ways to use this date data. For example, if your date is x implies it is the distance from the 1st of the month. Similarly, it is some distance y months from the first of the year (January).
The day also matters. If the day is Friday => it's 5 days from the week start. You can include this as a different feature.
KSP is another way of reducing the date into a useful feature. Year +(#ofdays from the start of the year -0.5) /#ofdays in the year(356 or 355) leap year or not a leap year.
Hope this is useful.