The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I need to create a prediction line for how the progress bar should look like.
(I am using a line and stacked column chart)
In my data table I have begin dates and end dates. I need a measure to choose the earliest and latest dates and create a linear line between it.
The yellow line is a new column, but it gives back the correct line in overall view. But as I use slicer or filter it doesn't change (as expected). Here is the code for it:
Regression =
VAR mind = MIN(Data_Table[Begin Date])
VAR maxd = MAX(Data_Table[End Date])
VAR dat = 'Calendar'[Date]
VAR dated = DATEDIFF(mind,maxd,DAY)
VAR todated = DATEDIFF(dat,maxd,DAY)
VAR fromdated = DATEDIFF(mind,dat,DAY)
RETURN IF(AND(fromdated>=0,todated>=0),(DIVIDE(todated,dated)-1)*(-1),IF(fromdated<0,0,1))
After this I tried to create the measure for it, but it doesn't work like it.
Here is the code:
Regression 2 =
VAR mind = MIN(Data_Table[Begin Date])
VAR maxd = MAX(Data_Table[End Date])
VAR dat = SELECTEDVALUE('Calendar'[Date])
VAR dated = DATEDIFF(mind,maxd,DAY)
VAR todated = DATEDIFF(dat,maxd,DAY)
VAR fromdated = DATEDIFF(mind,dat,DAY)
RETURN IF(AND(fromdated>=0,todated>=0),(DIVIDE(todated,dated)-1)*(-1),IF(fromdated<0,0,IF(todated<0,1,0)))
I don't mind the spikes on the dates where there is no date (missing column), but the slope start later and before that the value is 1 rather 0.
Any help with other approaches as well is much appricated it and have a lovely day.
Hi @Anonymous please check that you have the latest version of Power BI. For forecast feature please note
The forecasting feature is only available for line chart visuals.
Proud to be a Super User!
Hi @Anonymous did you try forecasting feature in Power BI
Check link https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-analytics-pane
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Proud to be a Super User!
Hey
Unfortunately this is not an option as I don't see it.
User | Count |
---|---|
18 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
27 | |
13 | |
12 | |
9 | |
8 |