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
fazza1991
Helper II
Helper II

Use previous months value as forecast to end of the year

Hi,

 

I would like to get a dax formula to use the previous months' value to be the forecast amount going forward

MonthRevenue3+9 Forecast
Feb-22£100£100
Mar-22£200£200

Apr-22

£300£300
May-22

0

£300
Jun-22

0

£300

 

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @fazza1991 

 

Try this code to add a new column:

Forecast = 
VAR _A = 'Table'[Month]
VAR _B =
    CALCULATE (
        MAX ( 'Table'[Month] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Revenue] <> 0 )
    )
VAR _C =
    CALCULATE (
        MAX ( 'Table'[Revenue] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Month] = _B )
    )
RETURN
    IF ( 'Table'[Revenue] = 0, _C, 'Table'[Revenue] )

 

Output:

VahidDM_0-1648505059320.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

 

View solution in original post

5 REPLIES 5
VahidDM
Super User
Super User

Hi @fazza1991 

 

Try this code to add a new column:

Forecast = 
VAR _A = 'Table'[Month]
VAR _B =
    CALCULATE (
        MAX ( 'Table'[Month] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Revenue] <> 0 )
    )
VAR _C =
    CALCULATE (
        MAX ( 'Table'[Revenue] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Month] = _B )
    )
RETURN
    IF ( 'Table'[Revenue] = 0, _C, 'Table'[Revenue] )

 

Output:

VahidDM_0-1648505059320.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

 

I should have mentioned the future dates will not exist in the table for example May & Jun wont be present in the table itself queries itself they only appear as the months go on so i need the dax to add those in assuming the amounts from previous month will be the same

@fazza1991 

 

Add a DATE table to your report and use that for adding future dates.

 

Check this link:

https://www.vahiddm.com/post/creating-calendar-table-with-3-steps

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

I have a calendar table, but doesnt seem to add to future dates just stops at the current month

Got this to work now - used it as a measure 

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