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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Oomsen
Helper III
Helper III

Salesforecast

Hello, i'm looking for a measure to forecast my sales. 

I would like to sum the actual sales by month until the current month.

For futher months i would like to have a average of the last 6 months. 

Example:

jan    feb     mrt   apr   may   jun   jul   aug

100     50       20   10      10    30   

 

july would be (100+50+20+10+20+30)/6 = 38

aug would be (50+20+10+20+30+38)/6 = 28

 

1 ACCEPTED SOLUTION

hi  @Oomsen 

I think it could not achieve in dax in power bi, this since it will calculate by its own value, it is very difficult to achieve.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Oomsen , use rolling 6 and divide by 6

example

Rolling 6 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-6,MONTH)) /6

or

Rolling 6 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX(Sales[Sales Date]),-6,MONTH))/6  

 To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak , thanks for your respons.

My current measure is 

fomzet = IF(MONTH(MIN(Dimdate[MaandVanJaar]))<=MONTH(TODAY()),
CALCULATE(SUM(Transacties[amountdc])*-1,'Grootboekclassificaties'[parent_description]IN{"Opbrengsten"},ALL('Grootboekclassificaties'[parent_code_attr])),
CALCULATE(SUM(Transacties[amountdc])*-1,'Grootboekclassificaties'[parent_description]IN{"Opbrengsten"},ALL('Grootboekclassificaties'[parent_code_attr]),DATESINPERIOD(Dimdate[Datum],MAX(Dimdate[Datum]),-6,MONTH))/6)
some parts are in dutch, sorry for that.
the current result is that the past and current month give the correct value but the future months are blank.

hi  @Oomsen 

Please make sure use Date field from Dimdate in the visual.

 

If you still have the problem, please share your sample pbix file for us have a test

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-lili6-msft @amitchandak  it works. 

For future months it is using 0 for calculating the average instead of the amount in the measure.

Example:

jan feb mrt apr may  jun  jul  aug  sep  oct  nov  dec

10  10  20   30   40    50   27  25    23

Expected:

jan feb mrt apr may  jun  jul  aug  sep  oct  nov  dec

10  10  20   30   40    50   27  31    33    

hi  @Oomsen 

I think it could not achieve in dax in power bi, this since it will calculate by its own value, it is very difficult to achieve.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.