How does forecast analytic in Power BI work? - powerbi

I have created the following forecast, Where:
Total Sales = CALCULATE(SUM(Data[Amount]), Data[Operation] = "SALE")
Total Sales Return = CALCULATE(SUM(Data[Amount]), Data[Operation] = "Return")
Sales Return Ratio = DIVIDE([Total Sales Return], [Total Sales])
I need to understand while Sales and Sales Return trends being stable in the forecast, why is Sales Return Ratio is going up?
What is the behind the scene logic for predicting forecast in Power BI?

Microsoft writes about it here.
They use an Exponential Smoothing algorithm. I did a quick comparison and it seems to be the same algorithm used in Excel's FORECAST.ETS() where ETS stands for Exponential Triple Smoothing.
I will not even try to explain that algorithm here, but I found this blog post that looks promising.

Related

Average doesn't calculate correctly in PowerBI

It wont be possible to share my data.
I've a lot of purchasing information with purchasing day, supplier, delivery value and quantity.
When I try to summarize it to get an average price per unit (Value / quantity), my calculations goes crazy.
Sometime delivered quantity for all deliveries haven't been registered, that results in "NaN". So i've been using a powerQuery to avoid that.
Formula: = if [Delivered Quantity] = 0 then 0 else [Delivered Value]/[Delivered Quantity]
Below is a picture of my problem, as you can see the "price per unit" is WAY to big.
Even if I delete the above formula and only use [Delivered Value]/[Delivered Quantity] and hide inifinity/NaN in filter, it still get some errors.
tried using an DAX formula:
avg price =
sum('Sum Tbl'[Delivered Value]) / sum('Sum Tbl'[Delivered Quantity])
and it worked.

Calculate percentage of a return value against the sale value in Power BI

I have a matrix in which there are companies, sale value, and return value.
I want to calculate that what percentage of the return value is from sales value
The sales value can be negative because there can be no sales.
How can I do it?
Any help would be highly appreciated.
You do this with measure
Percentage = sum(Table[Return value])/sum(Table[SALES VALUE])
Then select measure and click on % symbol in Measure tools. Numbers will be displayed
in %.
Try with this example, Its posted in powerbi community.
https://community.powerbi.com/t5/Desktop/Measure-to-calculate-average-in-line-stack-bar-chart/m-p/1608563#M650205

Calculate monthly Avg of daily percentage values

We have a report in Compliance% which is calculated every day. I have a requirement to calculate the Monthly Average of these daily Compliance% values.
PowerBI currently gives incorrect total value in a table format, I have attached the sample file. It is giving 56.90 in the grand total whereas I want to calculate sum(Compliance%)/count(day or month).
Could someone please help.
[
I think you need to introduce a new measure:
mDay =
IF(
HASONEFILTER(Table1[Compliance %]),
SUM(Table1[Day]),
FORMAT(
SUMX(Table1, Table1[Compliance %]) / COUNT(Table1[Day]),
"0.00%")
)
Here's the result for the month of February:
Here's another one if you also include a few values from March:
As you can see the measure responds to your table filters.
I hope it helps.

DAX query for calculating percentage of sales in Direct Query Mode in Power BI

I have a requirement where i have to summarise the sales data by department and then create a calculated column to show the percentage of how much each department had contributed towards total sales.
Here % should be the calculated column in Direct Query Mode
Since you did not provide much information or what you have already tried, I can't really guess your model, but I hope this gives you a starting point.
Create a new measure:
(replace the table name where needed)
% Sales Sub Category = DIVIDE(
SUM('Sales'[Sales]),
CALCULATE(SUM('Sales'[Sales]), ALL('Sales'[Sub Category])
)

Rolling Average - Calendar Table and slicers

I'm having an issue that i can't seem to solve on my own:
I have a model that has two tables.
Fruit_data_Table
Date
Fruit_id
Fruit_category
Fruit_scheduled_picking_time
Fruit_real_picking_time
Fruit_picked_within_1min = 1 or 0
Fruit_picked_within_5min = 1 or 0
etc etc
On every given day i have 700 different fruit entries on my fruit_data_table.
I created a Calendar_Table using a classic :
Calendar_Table= CALENDAR(MIN(Fruit_data_Table[Date]);MAX(Fruit_data_Table[Date]))
And then i needed combined averaged values for any given day, including rolling averages, so inside my Calendar_Table i added some calculated columns for every dates such as :
Fruit_on_time_1_min_pick=
VAR this_date = Calendar_Table[Date]
RETURN CALCULATE(
SUM(Fruit_data_Table[Fruit_picked_within_1min ])/COUNT(Fruit_data_Table[Fruit_picked_within_1min ]);Fruit_data_Table[Date] = this_date)
Or a rolling average :
Fruit_on_time_1_min_pick_7day_average=
VAR this_date = Calendar_Table[Date]
RETURN CALCULATE(
SUM(Fruit_data_Table[Fruit_on_time_1_min_pick])/COUNT(Fruit_data_Table[Fruit_on_time_1_min_pick]);
DATESBETWEEN(Calendar_Table[Date];DATEADD(LASTDATE(Calendar_Table[Date]);-6;DAY);LASTDATE(Calendar_Table[Date])))
Which mean i ahve something like
Calendar_Table
Date
Fruit_on_time_1_min_pick (%)
Fruit_on_time_1_min_pick_7day_average (%)
etc etc
This all seems to work pretty well and i have my daily rate of fruit pciked on time and rolling averages.
The problem is that then i can't use my slicer to sort by fruit_category, or by time_of_day for example... any idea how i can get back to those slicers ?
(The PowerBi rolling average function don't seem to work at all for me, even though my Calendar_Table is a PowerBi generated Date Table...)
Thank you very much !
PS: real code is about train numbers is a major french train station... not really about fruits :)