Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
some_analyst
Frequent Visitor

Forecast graph based on user input

I am wondering it this is even doable.

 

I have a graph where I have all pending applications and I also have a forecast. However, my client wants to see what the forecast would look like (trend) if they had a static decrease of pending applications, so right now there are 1000 and if they clear 35 (meaning input), when in time they would get to 400, vs if they input (reduce) 45.

Is this even possible to do it like that?

 

My data now is like this:

 

Week StartPendingPending - Forecast
03/03/20251000 
10/03/20251097 
17/03/20251055 
24/03/20251025 
31/03/20251001 
07/04/2025980 
14/4/2025 =same as last week - [Input]
21/4/2025 week before - [Input]
28/4/2025 week before - [Input]
05/05/2025 week before - [Input]

 

Input is user input and dynamic. Is it even possible?

 

Thanks a lot for help

 

6 REPLIES 6
v-dineshya
Community Support
Community Support

Hi @some_analyst ,

Thank you for reaching out to the Microsoft Community Forum.

 

Can you please follow below steps:

1. Create a What-If Parameter for Input (Reduction/Week):

Go to Modeling > New Parameter and call it Weekly Decrease.

Data type: Whole Number, Minimum: 0, Maximum: 100 , Increment: 1 and Default: 35

Power BI will create a slicer automatically so the user can select different values (e.g., 35, 45).

2. Build a Forecast Column (Calculated Column):

In your table (e.g., PendingApplications), create a new column:

Pending Forecast by Input =
VAR StartWeek = MINX(FILTER(PendingApplications, NOT(ISBLANK([Pending]))), [Week Start])
VAR StartPending =
CALCULATE(
MAX([Pending]),
FILTER(PendingApplications, [Week Start] = StartWeek)
)
VAR WeeksPassed =
DATEDIFF(StartWeek, [Week Start], WEEK)
VAR DecreasePerWeek = SELECTEDVALUE('Weekly Decrease'[Weekly Decrease])

VAR ForecastValue = StartPending - (WeeksPassed * DecreasePerWeek)

RETURN IF(ForecastValue >= 0, ForecastValue, 0)

This will dynamically calculate the forecast each week based on the selected reduction per week.

3. Plot the Forecast Line in Your Graph:

Add a line or combo chart with: X-axis: Week Start, Y-axis: both [Pending] and [Pending Forecast by Input]

Use the slicer from your What-If parameter to test different scenarios (e.g., reduce 35 per week vs. 45)

4. Add a Target Line (e.g., 400)

To show when the forecast crosses the 400 mark:

Create a constant line at 400 (Analytics pane) or create a target measure.

You can also use a DAX measure to calculate when the forecast would reach 400.

 

If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.

Thank you

Hi @some_analyst ,

If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.

Thank you

Irwan
Super User
Super User

hello @some_analyst 

 

please check if this accomodate your need.

Irwan_0-1744772527339.png

if yes, then create a new measure with following DAX

Pending Forecast =
var _MaxDate =
CALCULATE(
    MAX('Table'[Week Start]),
    FILTER(
        ALL('Table'),
        not ISBLANK('Table'[Pending])
    )
)
var _MaxValue =
MAXX(
    FILTER(
        ALL('Table'),
        'Table'[Week Start]=_MaxDate
    ),
    'Table'[Pending]
)
var _Input = SELECTEDVALUE('Input'[Input])
Return
IF(
    SELECTEDVALUE('Table'[Pending])<>BLANK(),
    SELECTEDVALUE('Table'[Pending]),
    _MaxValue-_Input
)
also i made another dummy table for Input because i assumed you have another table for your user to write their Input. if so, then replace the dummy Input table with your Input table.
 
Hope this will help.
Thank you,

Hi @Irwan , I figure out the input with a parameter. But I am having issues with the formula.

 

Pending Forecast = 
var _MaxDate = 
CALCULATE(
    MAX('dim_date'[Week Start]),
    FILTER(
        ALL('Dummy'),
        not ISBLANK('Dummy'[Pending])
    )
)
var _MaxValue = 
MAXX(
    FILTER(
        ALL('Dummy'),
        'Dummy'[Date]=_MaxDate
    ),
    'Dummy'[Pending]
)
var _Input = SELECTEDVALUE('What-If-Parameter'[What-If-Parameter])
Return
IF(
    SELECTEDVALUE('Dummy'[Pending])<>BLANK(),
    SELECTEDVALUE('Dummy'[Pending]),
    _MaxValue -_Input
)

 

The table result I get is this:

some_analyst_0-1744779267657.png

 

My dummy data looks like that:

some_analyst_1-1744779332720.png

 

hello @some_analyst 

 

for your first post, input is a table that consisted of user input as your post above.

Irwan_0-1744779798350.png

i am not sure but i assumed you have a way for user to write down their input.

User input should be in a form of table in PBI so you can get that dynamic value into calculation.

the input table in my pbix is a dummy table, so you need to change that table into user input table.

 

for your second post, in your screenshot, i assumed the negatif value is the problem and i assumed you put in 20 as input.

Irwan_1-1744780058512.png

this probably happens because the value is zero instead of blank in 28 April 2025, so the value becomes negative (0-20=-20).

if this the problem, then lets make a tweak in the DAX by adding not equal to 0.

Pending Forecast = 
var _MaxDate =
CALCULATE(
MAX('dim_date'[Week Start]),
FILTER(
ALL('Dummy'),
not ISBLANK('Dummy'[Pending])&&
'Dummy'[Pending]<>0
)
)
var _MaxValue =
MAXX(
FILTER(
ALL('Dummy'),
'Dummy'[Date]=_MaxDate
),
'Dummy'[Pending]
)
var _Input = SELECTEDVALUE('What-If-Parameter'[What-If-Parameter])
Return
IF(
SELECTEDVALUE('Dummy'[Pending])<>BLANK(),
SELECTEDVALUE('Dummy'[Pending]),
_MaxValue -_Input
)

this should take the 1096 value as last value then deducted with 20 in 28 April 2025.

 

Hope this will help.

Thank you.

Thank you @Irwan , this is nearly it. Do you know if there is a way that user can manipulate the field input - e.g. change it to another number just on the page? and the numbers of forecast will update by deducting that number for the following weeks?

 

some_analyst_0-1744778376261.png

 

Helpful resources

Announcements
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.

"); $(".slidesjs-pagination" ).prependTo(".pagination_sec"); $(".slidesjs-pagination" ).append("
"); $(".slidesjs-play.slidesjs-navigation").appendTo(".playpause_sec"); $(".slidesjs-stop.slidesjs-navigation").appendTo(".playpause_sec"); $(".slidesjs-pagination" ).append(""); $(".slidesjs-pagination" ).append(""); } catch(e){ } /* End: This code is added by iTalent as part of iTrack COMPL-455 */ $(".slidesjs-previous.slidesjs-navigation").attr('tabindex', '0'); $(".slidesjs-next.slidesjs-navigation").attr('tabindex', '0'); /* start: This code is added by iTalent as part of iTrack 1859082 */ $('.slidesjs-play.slidesjs-navigation').attr('id','playtitle'); $('.slidesjs-stop.slidesjs-navigation').attr('id','stoptitle'); $('.slidesjs-play.slidesjs-navigation').attr('role','tab'); $('.slidesjs-stop.slidesjs-navigation').attr('role','tab'); $('.slidesjs-play.slidesjs-navigation').attr('aria-describedby','tip1'); $('.slidesjs-stop.slidesjs-navigation').attr('aria-describedby','tip2'); /* End: This code is added by iTalent as part of iTrack 1859082 */ }); $(document).ready(function() { if($("#slides .item").length < 2 ) { /* Fixing Single Slide click issue (commented following code)*/ // $(".item").css("left","0px"); $(".item.slidesjs-slide").attr('style', 'left:0px !important'); $(".slidesjs-stop.slidesjs-navigation").trigger('click'); $(".slidesjs-previous").css("display", "none"); $(".slidesjs-next").css("display", "none"); } var items_length = $(".item.slidesjs-slide").length; $(".slidesjs-pagination-item > button").attr("aria-setsize",items_length); $(".slidesjs-next, .slidesjs-pagination-item button").attr("tabindex","-1"); $(".slidesjs-pagination-item button").attr("role", "tab"); $(".slidesjs-previous").attr("tabindex","-1"); $(".slidesjs-next").attr("aria-hidden","true"); $(".slidesjs-previous").attr("aria-hidden","true"); $(".slidesjs-next").attr("aria-label","Next"); $(".slidesjs-previous").attr("aria-label","Previous"); //$(".slidesjs-stop.slidesjs-navigation").attr("role","button"); //$(".slidesjs-play.slidesjs-navigation").attr("role","button"); $(".slidesjs-pagination").attr("role","tablist").attr("aria-busy","true"); $("li.slidesjs-pagination-item").attr("role","list"); $(".item.slidesjs-slide").attr("tabindex","-1"); $(".item.slidesjs-slide").attr("aria-label","item"); /*$(".slidesjs-stop.slidesjs-navigation").on('click', function() { var itemNumber = parseInt($('.slidesjs-pagination-item > a.active').attr('data-slidesjs-item')); $($('.item.slidesjs-slide')[itemNumber]).find('.c-call-to-action').attr('tabindex', '0'); });*/ $(".slidesjs-stop.slidesjs-navigation, .slidesjs-pagination-item > button").on('click keydown', function() { $.each($('.item.slidesjs-slide'),function(i,el){ $(el).find('.c-call-to-action').attr('tabindex', '-1'); }); var itemNumber = parseInt($('.slidesjs-pagination-item > button.active').attr('data-slidesjs-item')); $($('.item.slidesjs-slide')[itemNumber]).find('.c-call-to-action').attr('tabindex', '0'); }); $(".slidesjs-play.slidesjs-navigation").on('click', function() { $.each($('.item.slidesjs-slide'),function(i,el){ $(el).find('.c-call-to-action').attr('tabindex', '-1'); }); }); $(".slidesjs-pagination-item button").keyup(function(e){ var keyCode = e.keyCode || e.which; if (keyCode == 9) { e.preventDefault(); $(".slidesjs-stop.slidesjs-navigation").trigger('click').blur(); $("button.active").focus(); } }); $(".slidesjs-play").on("click",function (event) { if (event.handleObj.type === "click") { $(".slidesjs-stop").focus(); } else if(event.handleObj.type === "keydown"){ if (event.which === 13 && $(event.target).hasClass("slidesjs-play")) { $(".slidesjs-stop").focus(); } } }); $(".slidesjs-stop").on("click",function (event) { if (event.handleObj.type === "click") { $(".slidesjs-play").focus(); } else if(event.handleObj.type === "keydown"){ if (event.which === 13 && $(event.target).hasClass("slidesjs-stop")) { $(".slidesjs-play").focus(); } } }); $(".slidesjs-pagination-item").keydown(function(e){ switch (e.which){ case 37: //left arrow key $(".slidesjs-previous.slidesjs-navigation").trigger('click'); e.preventDefault(); break; case 39: //right arrow key $(".slidesjs-next.slidesjs-navigation").trigger('click'); e.preventDefault(); break; default: return; } $(".slidesjs-pagination-item button.active").focus(); }); }); // Start This code is added by iTalent as part of iTrack 1859082 $(document).ready(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); $("#tip2").attr("aria-hidden","true").addClass("hidden"); $(".slidesjs-stop.slidesjs-navigation, .slidesjs-play.slidesjs-navigation").attr('title', ''); $("a#playtitle").focus(function(){ $("#tip1").attr("aria-hidden","false").removeClass("hidden"); }); $("a#playtitle").mouseover(function(){ $("#tip1").attr("aria-hidden","false").removeClass("hidden"); }); $("a#playtitle").blur(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); }); $("a#playtitle").mouseleave(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); }); $("a#play").keydown(function(ev){ if (ev.which ==27) { $("#tip1").attr("aria-hidden","true").addClass("hidden"); ev.preventDefault(); return false; } }); $("a#stoptitle").focus(function(){ $("#tip2").attr("aria-hidden","false").removeClass("hidden"); }); $("a#stoptitle").mouseover(function(){ $("#tip2").attr("aria-hidden","false").removeClass("hidden"); }); $("a#stoptitle").blur(function(){ $("#tip2").attr("aria-hidden","true").addClass("hidden"); }); $("a#stoptitle").mouseleave(function(){ $("#tip2").attr("aria-hidden","true").addClass("hidden"); }); $("a#stoptitle").keydown(function(ev){ if (ev.which ==27) { $("#tip2").attr("aria-hidden","true").addClass("hidden"); ev.preventDefault(); return false; } }); }); // End This code is added by iTalent as part of iTrack 1859082
Top Solution Authors