Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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.
Solved! Go to Solution.
@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
@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
User | Count |
---|---|
84 | |
76 | |
72 | |
47 | |
37 |
User | Count |
---|---|
111 | |
56 | |
51 | |
42 | |
42 |