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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
milex01
Frequent Visitor

How to create actual cashflow?

Hi everybody,

 

I would like to create cashflow statements by using power bi. I do have some simple case that we can use to exercise this cashflow as following?

 

Anyone can suggest me a way of working? It can be differently than stated as below, but the purpose should be the same.

 

Thanks in advance!

Screenshot 2021-05-17 135123.jpg

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Please check example prepared on https://1drv.ms/u/s!AgAlCRkx-ILRgwn91AzYmq42ncQZ?e=pbuKCg

 

You need to create a date dimension table and relate this table to your purchase and sales tables. Then you can add a matrix visual to display the data as per your example. When you add the matrix table, make sure you go to Values then click the "Show on rows" toggle so that the Purchase and Sales appear as rows:

gdarakji_0-1621254036855.png

 

View solution in original post

Hi @milex01,

 

Please try this:

//calculated column
Ending balance = 
CALCULATE(
    SUM(PurchaseTable[Amount])+SUM(SalesTable[Amount]),
   FILTER(
       ALL(Dates),
       MONTH(Dates[Date])<=MONTH(EARLIER(PurchaseTable[Date]))))
//Measure
Start balance = 
CALCULATE(
    MAX(PurchaseTable[Ending balance]),
    FILTER(
        ALL(Dates),
        MONTH(Dates[Date])=MONTH(MAX(Dates[Date]))-1
    ))

Here is the output:

v-xulin-mstf_0-1621477880180.png

The pbix is attached.

 

Best Regards,
Link

 

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

 

View solution in original post

10 REPLIES 10
v-xulin-mstf
Community Support
Community Support

Hi @milex01,

 

You can try measures as:

Start balance = 
var _sum=
CALCULATE(
    MAX(PurchaseTable[Amount])+MAX(SalesTable[Amount]),
    FILTER(
       ALL(Dates),
        MONTH(Dates[Date])=MONTH(MAX(Dates[Date]))-1
    )
)
var _sum1=
CALCULATE(
    MAX(PurchaseTable[Amount])+MAX(SalesTable[Amount]),
    FILTER(
        ALL(Dates),
        MONTH(Dates[Date])=MONTH(MAX(Dates[Date]))-2
    )
)
return _sum+_sum1
Ending balance = 
CALCULATE(
    [Start balance],
    FILTER(
        ALL(Dates),
        MONTH(Dates[Date])=MONTH(MAX(Dates[Date]))-1
    )
)

 

Best Regards,
Link

 

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

I have applied the suggested measures and park them under purchase table as following

Screenshot 2021-05-19 113918.jpg

 

Below result is shown. Somehow the numbers are not quiet corresponding to the sum.

Screenshot 2021-05-19 113844.jpg

 

Hi @milex01,

 

This measure is dynamically calculated for the previous month's total.
Since there is no data before April, it is shown as empty.
You can enter more sample data for testing.

 

Best Regards,
Link

 

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

i have added more data from january 1st. see below result.

start and ending balance do not corresponding and the sum per column is wrond.

Screenshot 2021-05-19 143954.jpg

 

but when I switch the start and ending balance as following, the start and ending blance of each month are corresponding correctly, but the sum per column is still wrong.

Screenshot 2021-05-19 144024.jpg

first 2 calculations of start balance are correctly, but the then ending balance of march is not correct.

Screenshot 2021-05-19 145215.jpg

Hi @milex01,

 

Please try this:

//calculated column
Ending balance = 
CALCULATE(
    SUM(PurchaseTable[Amount])+SUM(SalesTable[Amount]),
   FILTER(
       ALL(Dates),
       MONTH(Dates[Date])<=MONTH(EARLIER(PurchaseTable[Date]))))
//Measure
Start balance = 
CALCULATE(
    MAX(PurchaseTable[Ending balance]),
    FILTER(
        ALL(Dates),
        MONTH(Dates[Date])=MONTH(MAX(Dates[Date]))-1
    ))

Here is the output:

v-xulin-mstf_0-1621477880180.png

The pbix is attached.

 

Best Regards,
Link

 

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

 

Great! Thanks for all the support! I will put solve on this issue.

 

Just one more thing, I tried to create some fake sales and purchase in dec 2020 (to generate the right start balance in jan 2021) but then the start balance of january 2021 do not update and the complete year of 2020 filled in by random number (i think)

 

Screenshot 2021-05-20 093103.jpg

 

So to solve this issue i removed the fake sales and purchase from dec 2020 and create a new table with new balance as shown below. Not perfect but it works!!

 

Screenshot 2021-05-20 092746.jpg

milex01
Frequent Visitor

done! thanks for your help

 

how to sum those numbers to update the starting (and ending) balance for each month as following?

 

Screenshot 2021-05-17 151955.jpg

Anonymous
Not applicable

Please check example prepared on https://1drv.ms/u/s!AgAlCRkx-ILRgwn91AzYmq42ncQZ?e=pbuKCg

 

You need to create a date dimension table and relate this table to your purchase and sales tables. Then you can add a matrix visual to display the data as per your example. When you add the matrix table, make sure you go to Values then click the "Show on rows" toggle so that the Purchase and Sales appear as rows:

gdarakji_0-1621254036855.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Users online (1,459)