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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

How to get Rolling total for forecast.

Hi Team,

 Can you please advise me how to calculate Runway (Rolling Total) in powerbi using DAX like below.

The below highlighed column is achived using Excel spreadsheet with Row No.  I am struggling to get it in powerbi DAX.

Runway by CF for Nov = Total of current forecast - forecast of Nov

Runways by CF for Dec onwards = Runway by CF - forecast of Dec  a and so on....

 

 

ashish_18_0-1721679050170.png

 

4 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Thanks Irwan. It works as column measure. For empty value,I can replace it with 0 for last month..right.?

Thanks for this solution buddy 🙂

View solution in original post

Its pretty easy. Just change the measure to this

 

 

RunAwayByCf = 
VAR _py =
    CALCULATE (
        IF ( SUM ( Data[CurrentForecast] ) = 0, 0, SUM ( Data[CurrentForecast] ) ),
        ALLEXCEPT ( Data, Data[FI Name]),
        MIN(Data[Index] ) <= Data[Index] -1
    )
RETURN
    INT ( _py )

 


which gives the following o/p. I have sorted it on FI Name so that its easy to validate the results.

SachinNandanwar_1-1721901662566.png

 



 

 



Regards,
Sachin
Check out my Blog

View solution in original post

Can you check if the DAX you are using is the same as one I posted last time ?

Recording 2024-07-26 at 21.18.38.gif

Now I am using the new code and I see no issues.




Regards,
Sachin
Check out my Blog

View solution in original post

Anonymous
Not applicable

HI @SachinNandanwar   its working with earlier code itself. 

 

Do u have any idea how to get Runway by Burn rate

Runway by Burn Rate calculated in excel 
Nov =SUM(C:C)-C2
Dec onwards = F2-E2,F3-E3,F4-E4
 
Expected result should show like this .
For CCC =--
IndexMonthSum of current costRunway by CCBurn RateRunway by Burn Rate
1Nov2182282819358253132.22819358
2Dec15940026599582182282566225.833
3Jan19064524693131906452347997.833
4Feb18313622861771831362157352.833
5Mar19396720922101939671974216.833
6Apr22977618624342297761780249.833
7May28392315785112839231550473.833
8Jun25777113207402577711266550.833
9Jul2805601040180253132.21008779.833
10Aug336528703652253132.2755647.6667
11Sep337392366260253132.2502515.5
12Oct3662600253132.2249383.3333

View solution in original post

36 REPLIES 36
SachinNandanwar
Super User
Super User

Incase if you want the calculation through a measure

RunAwayByCf =
VAR _py =
    CALCULATE (
        IF ( SUM ( Data[CurrentForecast] ) = 0, 0, SUM ( Data[CurrentForecast] ) ),
        ALLEXCEPT ( Data, Data[Index] ),
        MAX ( Data[Index] ) < ( Data[Index] )
    )
RETURN
    INT ( _py )

 

SachinNandanwar_0-1721815230736.png

 



 



Regards,
Sachin
Check out my Blog
Anonymous
Not applicable

Hi @SachinNandanwar  and @Irwan  Thansk for your solution as well. It works as a measure. Now,this code works for me when I have only 3 columns like Index,Month and Current Cost  for FI name "CCC" i.e single excel file having only CCC data.

 

ashish_18_0-1721846807010.png

 

 

However, when I use actual file which has same columns categorized into different FI Name..Thsi code doesnt work..Its giving wrong values in Runway. Can youn please suggest how to use this code for different values of FI for same month and monthly runway. This mentioned runway has wrong values now.

 

IndexMonthFI NameSum of Current CostRunway 
1NovCCC$218,2285346154
1NovBBB$3,5365346154
1NovAAA$210,9355346154
2DecCCC$159,4005073944
2DecBBB$3,0975073944
2DecAAA$109,7135073944
3JanCCC$190,6454700108
3JanBBB$15,4644700108
3JanAAA$167,7274700108
4FebCCC$183,1364356710
4FebBBB$13,5414356710
4FebAAA$146,7214356710
5MarCCC$193,9673973667
5MarBBB$19,1763973667
5MarAAA$169,9003973667
6AprCCC$229,7763530976
6AprBBB$24,9843530976
6AprAAA$187,9313530976
7MayCCC$283,9233072933
7MayBBB$12,8443072933
7MayAAA$161,2763072933
8JunCCC$257,7712580875
8JunBBB$39,1472580875
8JunAAA$195,1402580875
9JulCCC$280,5602027297
9JulBBB$57,2662027297
9JulAAA$215,7522027297
10AugCCC$336,5281374383
10AugBBB$73,2551374383
10AugAAA$243,1311374383
11SepCCC$337,392716991
11SepBBB$88,453716991
11SepAAA$231,547716991
12OctCCC$366,2600
12OctBBB$94,0590
12OctAAA$256,6720
Anonymous
Not applicable

Hi @SachinNandanwar  Thanks for your response.It really great and wrking for me now...

One last thing which I am struggling and appreciate if you can help me.  I need to calculate 2 columns based on current cost and runway for AAA,BBB and CCC.

BurnRate logic is if any current or future month,its avg of current cost otherwise current cost of that month.

I am using below column measure and its working only for CCC and not for other.as its taking avg of everything in that column.

burnrate1 = IF('Current Forecast'[Index]-2>=[CurrentMonthNo],'Current Forecast'[Avg],'Current Forecast'[Current Cost])
 
Runway by Burn Rate calculated in excel 
Nov =SUM(C:C)-C2
Dec onwards = F2-E2,F3-E3,F4-E4
 
Expected result should show like this .
For CCC =--
IndexMonthSum of current costRunway by CCBurn RateRunway by Burn Rate
1Nov2182282819358253132.22819358
2Dec15940026599582182282566225.833
3Jan19064524693131906452347997.833
4Feb18313622861771831362157352.833
5Mar19396720922101939671974216.833
6Apr22977618624342297761780249.833
7May28392315785112839231550473.833
8Jun25777113207402577711266550.833
9Jul2805601040180253132.21008779.833
10Aug336528703652253132.2755647.6667
11Sep337392366260253132.2502515.5
12Oct3662600253132.2249383.3333

 

For BBB---

IndexMonthSum of current costRunway by CCBurn RateRunway by Burn Rate
1Nov353644128637068.5441286
2Dec30974381893536404217.5
3Jan1546442272515464400681.5
4Feb1354140918413541385217.5
5Mar1917639000819176371676.5
6Apr2498436502424984352500.5
7May1284435218012844327516.5
8Jun3914731303339147314672.5
9Jul5726625576737068.5275525.5
10Aug7325518251237068.5238457
11Sep884539405937068.5201388.5
12Oct94059037068.5164320

 

For AAA -----

IndexMonthSum of current costRunway by CCBurn RateRunway by Burn Rate
1Nov2109352085510191370.42085510
2Dec10971319757972109351894139.583
3Jan16772718080701677271683204.583
4Feb14672116613491467211515477.583
5Mar16990014914491699001368756.583
6Apr18793113035181879311198856.583
7May16127611422421612761010925.583
8Jun195140947102195140849649.5833
9Jul215752731350191370.4654509.5833
10Aug243131488219191370.4463139.1667
11Sep231547256672191370.4271768.75
12Oct2566720191370.480398.33333

 

Expectation is all above FI should work using slicer and give such result..

This ?

BurnRate =
IF (
    VALUES ( Data[Index] ) - 2
        >= MONTH ( TODAY () ),
    CALCULATE (
        AVERAGE ( Data[CurrentForecast] ),
        ALLEXCEPT ( Data, Data[FI Name] )
    ),
    VALUES ( Data[CurrentForecast] )
)

 

SachinNandanwar_0-1721935079207.png

 



Regards,
Sachin
Check out my Blog
Anonymous
Not applicable

Hi @SachinNandanwar  Thanks for ur help.  I tried this code as new column,its giving below error

 

ashish_18_0-1721935920682.png

 

When tried it as new measure,it cant load visual

ashish_18_1-1721936043383.png

 

I am not seeing that error at my end. If possible can you share the source file ? 



Regards,
Sachin
Check out my Blog
Anonymous
Not applicable

Hi @SachinNandanwar   I have removed unwanted columns from actual source file and this one is export based on which I am calculating burn rate using ur code.

 

IndexMonthFI NameSum of Current CostRunway by Test1
1NovCCC M&S$218,2282819358
1NovIVR M&S$3,536441286
1NovP&V$210,9352085510
2DecCCC M&S$159,4002659958
2DecIVR M&S$3,097438189
2DecP&V$109,7131975797
3JanCCC M&S$190,6452469313
3JanIVR M&S$15,464422725
3JanP&V$167,7271808070
4FebCCC M&S$183,1362286177
4FebIVR M&S$13,541409184
4FebP&V$146,7211661349
5MarCCC M&S$193,9672092210
5MarIVR M&S$19,176390008
5MarP&V$169,9001491449
6AprCCC M&S$229,7761862434
6AprIVR M&S$24,984365024
6AprP&V$187,9311303518
7MayCCC M&S$283,9231578511
7MayIVR M&S$12,844352180
7MayP&V$161,2761142242
8JunCCC M&S$257,7711320740
8JunIVR M&S$39,147313033
8JunP&V$195,140947102
9JulCCC M&S$280,5601040180
9JulIVR M&S$57,266255767
9JulP&V$215,752731350
10AugCCC M&S$336,528703652
10AugIVR M&S$73,255182512
10AugP&V$243,131488219
11SepCCC M&S$337,392366260
11SepIVR M&S$88,45394059
11SepP&V$231,547256672
12OctCCC M&S$366,2600
12OctIVR M&S$94,0590
12OctP&V$256,6720

 

 

 

Hi @Anonymous 

I tested the query with the data you provided and I am not getting any errors.

SachinNandanwar_0-1722000150458.png

 






Regards,
Sachin
Check out my Blog
Anonymous
Not applicable

Hi @SachinNandanwar can you please try using this exact code . Rename column name and table name.  I am creating new column /new measure using this code . Its saying "A table of multiple values was supplied where a single value was expected."

 

BurnRate =
IF (
VALUES('Current Forecast'[Index]) - 2
>= MONTH (TODAY()),
CALCULATE (
AVERAGE('Current Forecast'[Current Cost]),
ALLEXCEPT('Current Forecast', 'Current Forecast'[FI Name])
),
VALUES ('Current Forecast'[Current Cost])
)

Thats very strange.

How about this ?

BurnRate = 
 IF (
  MAX( Data[Index] ) - 2
        >= MONTH ( TODAY () ),
    CALCULATE (
        AVERAGE ( Data[CurrentForecast] ),
        ALLEXCEPT ( Data, Data[FI Name] )
    ),
     SUM(Data[CurrentForecast] )
)


Regards,
Sachin
Check out my Blog
Anonymous
Not applicable

Hi @SachinNandanwar   This is good knowledge sharing discussion :).

I have tested with your new/latest  code ,it work with no error but it shows avg value in all fields.

 

However,I have found out the root cause,I have removed "VALUES" from your earlier code and it works well now. Its strange but it was looking for single value VS multiple table values

 

BurnRate =
IF (
('Current Forecast'[Index]) - 2
>= MONTH (TODAY()),
CALCULATE (
AVERAGE('Current Forecast'[Current Cost]),
ALLEXCEPT('Current Forecast', 'Current Forecast'[FI Name])
),
('Current Forecast'[Current Cost])
)

 

This code is working Now.. Thanks for your helping hand.

 

Now,only blocker is to have runway based on burn rate. I will try using ur runwayCF code but its not giving me expected result. Can you plz try from ur end when feasible

 

 

Runway by Burn Rate calculated in excel 
Nov =SUM(C:C)-C2
Dec onwards = F2-E2,F3-E3,F4-E4
 
Expected result should show like this .
For CCC =--
IndexMonthSum of current costRunway by CCBurn RateRunway by Burn Rate
1Nov2182282819358253132.22819358
2Dec15940026599582182282566225.833
3Jan19064524693131906452347997.833
4Feb18313622861771831362157352.833
5Mar19396720922101939671974216.833
6Apr22977618624342297761780249.833
7May28392315785112839231550473.833
8Jun25777113207402577711266550.833
9Jul2805601040180253132.21008779.833
10Aug336528703652253132.2755647.6667
11Sep337392366260253132.2502515.5
12Oct3662600253132.2249383.3333

Can you check if the DAX you are using is the same as one I posted last time ?

Recording 2024-07-26 at 21.18.38.gif

Now I am using the new code and I see no issues.




Regards,
Sachin
Check out my Blog
Anonymous
Not applicable

HI @SachinNandanwar   its working with earlier code itself. 

 

Do u have any idea how to get Runway by Burn rate

Runway by Burn Rate calculated in excel 
Nov =SUM(C:C)-C2
Dec onwards = F2-E2,F3-E3,F4-E4
 
Expected result should show like this .
For CCC =--
IndexMonthSum of current costRunway by CCBurn RateRunway by Burn Rate
1Nov2182282819358253132.22819358
2Dec15940026599582182282566225.833
3Jan19064524693131906452347997.833
4Feb18313622861771831362157352.833
5Mar19396720922101939671974216.833
6Apr22977618624342297761780249.833
7May28392315785112839231550473.833
8Jun25777113207402577711266550.833
9Jul2805601040180253132.21008779.833
10Aug336528703652253132.2755647.6667
11Sep337392366260253132.2502515.5
12Oct3662600253132.2249383.3333

Should this calculation "Nov =SUM(C:C)-C2" be specific only for the month of Nov ?



Regards,
Sachin
Check out my Blog
Anonymous
Not applicable

HI @SachinNandanwar  Yes..Its specific to Nov only. Rest should be like (Dec onwards ) = F2-E2,F3-E3,F4-E4

Anonymous
Not applicable

HI @SachinNandanwar  any luck in getting Runway by Burn rate

Nov =SUM(C:C)-C2
Dec onwards = F2-E2,F3-E3,F4-E4

Which column does F corresponds to ?



Regards,
Sachin
Check out my Blog
Anonymous
Not applicable

HI @SachinNandanwar 

 

Runway by Burnrate for Nov = Total of current cost - Nov cost i.e.( C:C)-C2
Runway by Burnrate for Dec =Runway by Burnrate for Nov - burn rate of Nov i.e F2-E2
Runway by Burnrate for Jan =Runway by Burnrate for Dec - burn rate of Dec i.e F3-E3
and so on

It should work for any FI liek AAA,BBB,CCC like we did for prev runway.

 

Can you please explain for these 3 rows ?

IndexMonthSum of current costRunway by CCBurn RateRunway by Burn Rate
1Nov2182282819358253132.22819358
2Dec15940026599582182282566225.833
3Jan19064524693131906452347997.833


Your requirements are still not clear.
You said "Runway by Burnrate for Nov = Total of current cost - Nov cost i.e.( C:C)-C2"

What does C : C mean here ?



Regards,
Sachin
Check out my Blog
Anonymous
Not applicable

Hi @SachinNandanwar 

If excel row number are confusing then u can ignore.. Actual requiremnt is as below.

 

Runway by Burnrate for Nov = Total of current cost - Nov cost i.e.( C:C)-C2
Runway by Burnrate for Dec =Runway by Burnrate for Nov - burn rate of Nov i.e F2-E2
Runway by Burnrate for Jan =Runway by Burnrate for Dec - burn rate of Dec i.e F3-E3
and so on

 

(C:C ) means All rows of column "current cost". I taken that to take total of that column and minus current cost of Nov (C2)

 

Actual excel for "AAA" is as below but in main source file AAA,BBB,CCC are added as column so runway and burn rate shoudl work when we select AAA,BBB,CCC from slicer.

 

ashish_18_0-1722259177705.png

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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