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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
nywi6100
Frequent Visitor

Select the next number of months to display

I am working on some Day's Inventory on Hand measures. In order to do this, I need to select the next four months of forecast and get them to display by month in a visual. For example:

 

We are currently in June. So I need to select June, July, August, and September from the forecast data. In the visual, I want to display Each month with it's forecast quantity. Then, when I roll into July, I want the visual to display the next four months of visual forecast (i.e. July thru October). I do not want to use filters to do this. 

 

I have a Fiscal Date table which has the date, month, year, month number 1-12). My thought was to add a calculated column as a yes/no for the "Next Four Forecast". But not sure how to get there. 

 

So fields available:

Forecast Quantity

Date

Fiscal Month

Fisal Year

Fiscal Month Number

2 REPLIES 2
camargos88
Community Champion
Community Champion

Hi @nywi6100 ,

 

Another way would be using what if parameter.

You can calculate the number of months dynamically.

 

https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-what-if



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



lbendlin
Super User
Super User

yes, calculated column is the way to go. Let's assume you have a FiscalMonth column in your Fiscal calendar table.

 

NextFourMonths = 
var d=Dates[date]
var s=SELECTCOLUMNS(filter(Dates,Dates[date]>=EDATE(d,1) && Dates[date]<=edate(d,4)),"FMonth",Dates[Fiscal Month])
return concatenatex(distinct(s),[FMonth],",",[FMonth],ASC)

 

This is slow as molasses but it may give you some ideas how to tackle the issue. EDATE seems an innocent choice here but it is actually pretty smart, handling month math nicely even with different length months.

 

 

 

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors