Skip to main content

Forecast Data using Power BI

With the September Community Preview Power BI analytics tool allow us to do simple forecasting with data without doing complex DAX or any other mechanism. You can download it from September release

After successful Power BI desktop install you have to enable Forecasting feature from Preview Features.

Go to File - > Options and Settings - > Options



In the Options menu click the Preview Features tab and check Forecasting


Now the forecasting feature has been enabled successfully in your Power BI desktop version. Next step is to create dataset. For that I used AdventureWorksDW2014 database dbo.vTimeSeries view. I make some aggregations for existing data and create another view on top of that in order to make the demo successfully. Because for time series data we have some constrains like the time data variable must be Date data type likewise. And the existing view contains multiple records for particular month by reporting date. I obtain the Summation of the Sales amount for each month. Here is the code.

 
USE AdventureWorksDW2014
GO

CREATE VIEW [dbo].[vForeCast]
AS (
SELECT [CalendarYear]
 , [Month] 
 , SUM(Amount) AS Amount 
 , CAST(LTRIM(RTRIM(CalendarYear)) AS CHAR(4)) + '-' + IIF(LEN(MONTH) = 1, '0'+CAST(Month AS CHAR(1)) , CAST(Month AS CHAR(2))) + '-01' AS Date
FROM [dbo].[vTimeSeries]
GROUP BY [CalendarYear], [Month]  
);

Now, go to power BI desktop and Get data in order to import data in to the data model. (Please, note that I'm not give the steps for connecting to a 

Give the server credentials where I need to connect with

From the next window in Navigator pain select the data source.



Now data is successfully loaded to the Power BI data model.


Remember, we need to take care of our data types. The date field data type need to be Date data type. Lets go to the Reporting tab.


Select Line Chart and data you need to plot.


When you select Fields you have to select one Measure and date field. In my case I select Amount as measure and Date field.


In the Axis window down arrow pick Date instead of Date Hierarchy (Because we are dealing with dates in the time series)


Now the Line chart will looks like below.




Now go to Analysis tab in the right. At the bottom there is a forecast pane. Expand it and ready to configure.



You can configure Forecast lengths (How many data points or period (Months , Quarters), confidence interval etc. 

After do the configurations click apply. You can now see the forecast in the line chart as below.




Comments

  1. Hillary, Thanks a lot for the comment :-)

    ReplyDelete
  2. Super blog! very clear information with diagrams very understandable thanks keep update Power BI Online Training Bangalore

    ReplyDelete
  3. It's Very informative blog and useful article thank you for sharing with us , keep

    posting learn more about BI Tools
    Tableau Online Training

    ReplyDelete

  4. You have discussed an interesting topic that everybody should know. Very well explained with examples. I have found a similar website
    data science consulting
    visit the site to know more about Omdata.

    ReplyDelete
  5. Your blog is very nice and provide me informative content thanks for sharing for more information about Power Bi vs Tableau

    ReplyDelete
  6. Here is Mr Benjamin contact Email details,lfdsloans@outlook.com. / lfdsloans@lemeridianfds.com Or Whatsapp +1 989-394-3740 that helped me with loan of 90,000.00 Euros to startup my business and I'm very grateful,It was really hard on me here trying to make a way as a single mother things hasn't be easy with me but with the help of Le_Meridian put smile on my face as i watch my business growing stronger and expanding as well.I know you may surprise why me putting things like this here but i really have to express my gratitude so anyone seeking for financial help or going through hardship with there business or want to startup business project can see to this and have hope of getting out of the hardship..Thank You.

    ReplyDelete

Post a Comment

Popular posts from this blog

Step-by-Step Twitter Sentiment Analysis Using Power BI Streaming Dataset, Microsoft Flow and Azure Text API

Sentiment Analysis is known as Opinion mining or emotion AI which is a branch of Natural Language Processing and text analytics where systematically identify, extract, quantify, and study affective states and subjective information. This kind a analysis widely apply to analyse the product or service reviews, voice of the customer, survey responses from online and social media feeds to analyze the attitude of the customer. Basically from the sentiment analysis the output would be either Positive, Negative or Neutral.  There are various algorithms and methods to do a sentiment analysis out there. In this post here I'm doing a sentiment analysis for iPhone 8 product by analyzing twitter feeds. Because, I wanted to know what others are thinking about the latest phone released by Apple. In order to do this task I'm using,  Microsoft Azure cognitive services : Text Analytics (to run the sentiment analysis algorithms to get out the results)  Microsoft Flow ...

How to Get Row Counts for all Tables in your SQL Database

This is the simplest method to get the row counts of all tables in your SQL Server database. Might be useful when you are doing the data testing over your BI project.     select   schema_name (tab.schema_id) , tab.name  as  [table],         sum (part.rows)  as  [rows]     from  sys.tables  as  tab          inner join  sys.partitions  as  part              on  tab.object_id  =  part.object_id where  part.index_id  IN  ( 1 ,  0 )  //   0 :  Table   without  PK,  1 :  table   with  PK and   schema_name (tab.schema_id)  =   'dbo'   group by   schema_name (tab.schema_id) , tab.name --order by sum(part.rows) desc  

COVID-19 Situation in Sri Lanka: Real-time Dashboard using Power BI

[Updated on March 28, 2020] COVID-19  is a new strain that was discovered in late December, 2019 and by now it has been started to spread all over the world including 199 countries. There are around 26,000 people were died due to the virus and 580,000 confirmed cases at the moment I update this blog post. Though, the fatality rate is lower when compared to other viruses in similar strains like MERS and SARS . However, the biggest challenge most of the countries facing right now is to accommodate the patients with the growing numbers at every minute. The public was asked by the government to avoid nonessential gatherings as much as possible to stop spreading this deadly virus. Even though there were not many cases found in Sri Lanka, from March first week, they found the initial case a patient who works as a tourist. Now the situation is turning to worst after they found many cases especially tourists who are born Sri Lankans came down from Italy and European countries....