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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
mq2020
Helper III
Helper III

Forecast value equal to last actual value

I have a table with amounts per month.

I'd like to create a new column to fill in the future months which are now blank (July 2020 onwards) by using the amount of the previous month (in this case using the amount of June 2020 but this has to change dinamically every month).

 

I've create the following measure to calculate the amount of the previous month but it will only populate 1 line (July 2020), I dont know how to make it populate all the remaining future months - any ideas?

 

My current formula is like this:

Prev Month Amount £ = CALCULATE(Sum(Transactions[Amount]),PREVIOUSMONTH('Calendar'[Date]))

 

 

Prev Month.png

1 ACCEPTED SOLUTION

Please try this expression

 

Prev Month = var __thismonth = SUM(Transaction[Amount])
var __maxdate = CALCULATE(MAX(Transaction[Date]), ALL('Date'))
var __start = DATE(Year(__maxdate), Month(__maxdate),1)
var __prevsales = CALCULATE(SUM(Transaction[Amount]), DATESBETWEEN('Date'[Date], __start, EOMONTH(__start,0)))
return IF(ISBLANK(__thismonth), __prevsales, __thismonth)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@mq2020 , only for July

Prev Month Amount £ =
if(eomonth(max('Calendar'[Date]),1) = eomonth(today(),1),
CALCULATE(Sum(Transactions[Amount]),PREVIOUSMONTH('Calendar'[Date])), blank())

 

for future months try like

Future Month Data =
var _max = eomonth(maxx(Transactions,Transactions[Date]),0)
var _min = eomonth(_max,-1)+1
var _cal = calculate(Sum(Transactions[Amount]), filter(all('Calendar'[Date]), 'Calendar'[Date] >=_min && 'Calendar'[Date] <=_max))
return
if(eomonth(max('Calendar'[Date]),1) >= eomonth(today(),1),_cal,blank())
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 help.

 

I tried both formulas and this is what it returns.

Do I need to modify something in the future months formula so that it populates the rest of months?

 

Thanks

Prev Month 2.png

Hi,

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Please try this expression

 

Prev Month = var __thismonth = SUM(Transaction[Amount])
var __maxdate = CALCULATE(MAX(Transaction[Date]), ALL('Date'))
var __start = DATE(Year(__maxdate), Month(__maxdate),1)
var __prevsales = CALCULATE(SUM(Transaction[Amount]), DATESBETWEEN('Date'[Date], __start, EOMONTH(__start,0)))
return IF(ISBLANK(__thismonth), __prevsales, __thismonth)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors