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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
EJNGE
Regular Visitor

Forecast running total from a specific date with a base sum

Hello,

I am trying to calculate a running total of a forecast from a specific date but I need to use all the previous costs. The forecast needs to start tomorrow and any date prior would be 0 as these are in costs.

Hopefully the tables below can show what I mean a bit better where the cumulative forecast for the future (starting on the 31/08/2022) is the sum of the costs + the forecast.

Date Costs  Forecast Cumulative forecast
26-Aug-22 £                           44,041.74   
27-Aug-22 £                           32,844.04   
28-Aug-22 £                           47,442.25   
29-Aug-22 £                           49,287.31   
30-Aug-22 £                           32,844.04   
31-Aug-22   £                  48,012.17 £                 254,471.55
01-Sep-22   £                                 -   £                 254,471.55
02-Sep-22   £                  73,369.44 £                 327,840.99
03-Sep-22   £                  30,260.72 £                 358,101.71
04-Sep-22   £                  30,260.72 £                 388,362.43
05-Sep-22   £                  47,442.25 £                 435,804.69
06-Sep-22   £                  30,962.03 £                 466,766.71
07-Sep-22   £                  39,752.66 £                 506,519.37

 

I cannot find a way to do this using Dax or power query, I keep getting a running total from the start.

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@EJNGE So like this?

Cumulative forecast column = 
  VAR __StartDate = DATE(2022,8,31)
  VAr __Date = [Date]
  VAR __Costs = SUMX(FILTER(ALL('Table'), [Date] < __StartDate),[Costs])
  VAR __Forecast = SUMX(FILTER(ALL('Table'), [Date] >= __StartDate && [Date] <= __Date),[Forecast])
RETURN
  __Costs + __Forecast


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

@EJNGE So like this?

Cumulative forecast column = 
  VAR __StartDate = DATE(2022,8,31)
  VAr __Date = [Date]
  VAR __Costs = SUMX(FILTER(ALL('Table'), [Date] < __StartDate),[Costs])
  VAR __Forecast = SUMX(FILTER(ALL('Table'), [Date] >= __StartDate && [Date] <= __Date),[Forecast])
RETURN
  __Costs + __Forecast


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hello @Greg_Deckler ,

 

Thanks this is worked brilliantly.

 

Regards,

 

EJNGE

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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