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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Projected Cash Balance based on dynamic historical average

Expert Community,

 

I need some expert advice on how to predict a cash balance based on ''fixed" monthly projected average using historical data in PBI. Please find below table an illustration of the structure (consolidated and built in Excel). 

Actual data: Cash Flow data is based on General Ledger Entries

Henrik_Hoff_0-1604663789678.png

 

Situation: This period have 9 (X) months of aggregated historical reported numbers related to cash expenditure (Outflow). The outflow is subtracted from the starting cash balance each month. The projected average cash flow is dynamically calculated and updated based on realised numbers (X)

Complication: How to construct a DAX measure that applies the historical average as a fixed projected average to predict the future cash balance?

 

 

 

image.png

Please state if you need additional information. Thank you. 

Best regards,

Henrik

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

You can add a index column in your raw table:

Capture1.PNG

 

Then use the following two measure:

 

 

Projescted Average Cash Outflow = IF(ISBLANK(MAX('Table'[Actual Cash Balance])),AVERAGEX(FILTER(ALL('Table'),NOT(ISBLANK('Table'[Outflow]))),'Table'[Outflow]),BLANK())

Cash Balance = IF(ISBLANK(MAX('Table'[Outflow])),CALCULATE(FIRSTNONBLANK('Table'[Actual Cash Balance],1),ALL('Table'))+SUMX(FILTER(ALL('Table'),'Table'[Index]<=MAX('Table'[Index])),[Projescted Average Cash Outflow]),MAX('Table'[Actual Cash Balance]))

 

Capture2.PNG

 

For more details, please refer to the pbix file:https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/Ed3rn4lZMJ9El3ebxyhhJf4BNa4DQdpJ2Don766DUpaHcA?e=TumfV0

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

 

View solution in original post

4 REPLIES 4
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

Would you please show us some sample data and expected output with details? I don't get your logic for calculation well based on your description. Is the rolling average you want? If so, please refer to  https://www.mssqltips.com/sqlservertip/5635/creating-a-rolling-average-graph-with-power-bi/

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

Anonymous
Not applicable

Hi @v-deddai1-msft ,

Thank you for replying to my question. 

 

Please find below a consolidated screedump of the two important steps. As the forum does not support upload of xlsx-format, I can forward the sample data via e-mail. I appreciate your input, unfortunately it is only a part of the solution. 

 

The "Projected average cash outflow" is based on the rolling average. The issue I am facing is how apply the average (rolling average) as a fixed value in future N periods which will provide be with a 'future' Cash Balance (marked in green). 

I can add that I have tried to create a "Forecasting formula" using DAX, however as the formula is dynamic into the future it has limited utility. The formula was made as variables using past 12 month, for instance: 
VAR CF_1Mago = Calculate([Cash Outflow];DATEADD(DimDate[Date];-1;MONTH))

 

The Cash balance equation would be: F(x) = 1.000.000 + Cash Outflow_t + Projected (rolling) average cash outflow_t,


image.png
Best regards,
Henrik Hoffmann

Hi @Anonymous ,

 

You can add a index column in your raw table:

Capture1.PNG

 

Then use the following two measure:

 

 

Projescted Average Cash Outflow = IF(ISBLANK(MAX('Table'[Actual Cash Balance])),AVERAGEX(FILTER(ALL('Table'),NOT(ISBLANK('Table'[Outflow]))),'Table'[Outflow]),BLANK())

Cash Balance = IF(ISBLANK(MAX('Table'[Outflow])),CALCULATE(FIRSTNONBLANK('Table'[Actual Cash Balance],1),ALL('Table'))+SUMX(FILTER(ALL('Table'),'Table'[Index]<=MAX('Table'[Index])),[Projescted Average Cash Outflow]),MAX('Table'[Actual Cash Balance]))

 

Capture2.PNG

 

For more details, please refer to the pbix file:https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/Ed3rn4lZMJ9El3ebxyhhJf4BNa4DQdpJ2Don766DUpaHcA?e=TumfV0

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

 

Anonymous
Not applicable

Hi Dedmon,

Thank you for your solution which is acceptable, if my dataset was identifical to your Power BI data.
However, my dataset is somewhat more complicated then originally described (I tried to simplify it). 

The dataset is based on General Ledger Entries with daily transactions. This means that I cannot apply the average X function, as it takes the daily average, unless it can be adjusted perhaps nested in a SUMX function to obtain the monthly average. The last posting date can be assumed to be "TODAY". 

 

I have attached the basics of data model to assist in finding the solution. 

 

Henrik_Hoff_2-1605084903693.pngHenrik_Hoff_3-1605085141356.png

 

Br

Henrik 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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