How to forecast in Power BI using DAX - powerbi

I have a chart in excel I wish to replicate in PBI.
My Excel chart is a bar chart dated axis with 2 series, running up march, but with data only up until now.
Each bar series has a trendline, which forecasts a trend up to the end of the financial year.
In power BI I have tried to replicate, but I cannot seem to add 'forecast' from the analytics tab unless my chart is a line graph.
So I now have 2 line series in a chart like so:
I have added trendline to both but there is no option to add the forecast line unless I only have 1 data series.
As I've removed a series I can now toggle on the forecast line in the analytics tab.
So I now have 1 line series in my line graph like so:
I actually need to have the data and the corresponding forecast for both data series, so I would have series 1 & 2 plotted like above, on the same graph together.
Is there a way to do this on the analytics tab??
If not, how should I go about it? I was thinking I could use DAX to forecast until March 2023 instead and then drag the line into the line graph and format it to dashed?
Thanks
Here is some sample data step by step for what i'm looking for (very simple thing to do in excel!):
This is the same data, pivoted with the 2 series mapped out on a line graph, and trendline added for each:
I just want to be able to show a trendline extending and forecasting forward, past the months I already have like I have done in Excel.

Yeah i think here your best solution would be to use the "what if" parameter in Dax to get the result you need

For a forecasting line to be performed on a line chart, Below requirements should be met. Otherwise You can't see this option on the analytics tab:
You need to change your datasets, and datatypes accordingly.
The last one is especially valid for you, because there is not a one-day period between your data values, in fact monthly organized.

Related

Summing totals from same date ranges, and getting the range value for those totals

I have the following data currently in PowerBI
This is totals for multiple entities that are under the same location (ID 1).
What I would like to produce is the following
Which is the summation of the 3 totals over time, with start and end dates of when they applied.
I will eventually try to use this to show a trending chart over time for how the totals changed.
Is something like this even possible in PowerBI and/or DAX to first produce the results and then report a trend line like that? The trend line in this example would just have the 3 data points.
The only thing I can think of right now is to extrapolate out each range to 1 day at a time per original screenshots rows, and make the granularity of the chart daily, instead of ranges like this. Then the summation becomes a lot simpler as its just be ID and Date. Only concern is the data volumes that will be produced by extrapolating this out by days like that.

How to get multiple category lines with bar chart in Power Bi?

Sample Data.
CompanyA,2019-01-01,29000
CompanyA,2019-02-01,35000
CompanyA,2019-03-01,43000
CompanyA,2019-04-01,27000
CompanyA,2019-05-01,45000
CompanyA,2019-06-01,21000
CompanyA,2019-07-01,26000
CompanyA,2019-08-01,27285
CompanyA,2019-09-01,26035
CompanyA,2019-10-01,24785
Expected Output.
My Boss has asked me to show sale trend by companies and month. but he wants it to be shown like below.
X axis should have Month Names
Bar lines should tell overall sales amount by month.
multiple lines should represent company sales amount.
i have achived this output by replacing 2 charts on each other (hidden one background). 
First i have taken a CLUSTERED COLUMN CHART and place a Line chart on it with hidden background.
Sample File
But for me this is just an adhoc solution and One more problem is that both chart's y axis doesn't match.
seeking for a good solution on this. either another good chart to represent this kind of data or how to achive it any other way?
Thanks in advance.
You can create measures for individual company, if number of companies is not a big number, and then put them in "Line values" to achieve the same result as above.
So For ex, if you have 5 companies in the data then create 5 different measures like below
CompanyA = calculate(sum(sales), filter(tbl, [company] = "CompanyA"))
like the above ex create measures for other 4 companies also

Line Graph in Power BI

Two-line graph with slicers: Everything looks fine until date selections are made.
I figure that this failure has something to do with the line graph and date functionality. Date selections work together in a very weird way. Selecting only 2019 months and then only 2020 months, both lines disappear.
If the date slicers are going to work together, I should expect inclusive behavior, rather than "NOT 2020 AND NOT 2019"!
See relationships.
How do I get the behavior intended on one two-line graph?
Thanks!
I agree with #teylyn, sometimes less is more.
The problem is how Power Bi works and how your measures are calculated. You have two averagex-measures, both pointing to same date table. In Power BI, two separate filters from a single dimension can't do "union", they are laid down on top of each other. You are telling that first I want to filter by 2019 November and after the filter has been evaluated, you tell that you want to filter 2020 January. Power BI adds new filter to already filtered dataset, but the dataset doesn't contain anything that match both filters, so the end result is empty.
One way to get around this problem is to create separate date-tables for filtering purposes for blue and green. Here is an example of the data model needed:
Then you update the date-filters in second tab. Set blue date filter to one date-dimension and green date filter to another. This way they aren't filtering the same table and the graph should work the same as before.

How to deal with missing dates in Power BI line charts? (Tabular SSAS)

In SSAS Tabular mode, we have different tables with slowly changing dimensions (SCD Type 2). In Power BI, we now want to show for example the price history for one object over time. I want to display that with a Line Chart.
For the sample data, I added a Line Chart and activated the "Stepped" property in "Shapes", to have a clear cut of the price change. But unfortunately, Power BI displays the price change on Oct 5th (because this is the middle date between 3th and 7th) instead of Oct 7th. I know, that I would be able to solve it on database view layer, but I don't want to create so much data records for all different tables.
PRICE TABLE
**************************************
Price Valid from Valid To
**************************************
3'674 02.10.2019 02.10.2019
3'674 03.10.2019 06.10.2019
11'095 07.10.2019 07.10.2019
11'095 08.10.2019 01.01.2999
**************************************
Is there any way to prevent this behavior in the Power BI visualization or can I somehow calculate the missing dates in DAX?
I would have use date field from date dimension which has all the continuous date, then you may change your axis type for date continuous and it will generate smooth transition.

Can Power BI add range selection to a Line Chart?

I'd like to build a report with power BI line chart. For there are too many values on the X-Axis, I was trying to add a range selection on the X-Axis like what amChart does.
So, I'm wondering if power BI can do this.
Also, I want to add hyperlink to each value on the X-Axis to link to related shared folder, is it doable?
For time range selection, take a look at https://app.powerbi.com/visuals and try the Advanced Time Slicer visual. It might already do what you're looking for.
For the x-axis urls, you have several approaches you can try. The easiest approach is to have a related table in your report that shows the links. Then when a user selects a datapoint in your line chart, the table would update to show the relevant links. Alternately you might try to extend the Power BI line chart with your own logic. This might be hard since Cartesian charts are more complex than other charts. You can find the line chart code here: https://github.com/Microsoft/PowerBI-visuals/blob/master/src/Clients/Visuals/cartesian/lineChart.ts
Alternately you can just write your own purpose built visual that does exactly what you want. This might actually be easier than extending the Power BI chart. You can learn how to build your own visual by looking at our wiki: https://github.com/Microsoft/PowerBI-visuals/wiki
I was thinking about this more and wanted to mention one more solution. If you're looking to show the 'last n days' of data, instead of an arbitrary range, you can add a measure in DAX that returns the last days. I have an example here: http://blogs.msdn.com/b/lukaszp/archive/2015/08/08/finding-the-latest-date-in-power-bi-desktop.aspx