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
RichOB
Post Patron
Post Patron

Need help with Investment data calculations please!

I have a bit of a head-scratcher to get to a calculation for investment figures. Using the raw data in Table1, I need to create a Table2 2 in a matrix/table visual. I need:


- I do not have the Rolling_Amount column, that is there to show what I need. I need it to show the Rolling_Amount figure based on the accumulation of the previous month's Amounts.

    e.g April to July is 2900, April to August is 3400.

 

- A Calculation that gives the Monthly_Difference between the monthly Investment amount

   e.g May - April = 200. June - May = 1200.

 

- A calculation to get the Cash Movement, which is the Movement on Investments - Monthly_Difference.

  e.g May is 200 - 70. Cash_Movement Total for May is 130

 

Table 1   
CategoryPosting_DateAmountRolling_Amount
Investments30/04/2024600 
Investments31/05/2024200800
Investments31/06/202412002000
Investments30/07/20249002900
Investments31/08/20245003400
Investments30/09/2024-5002900
Investments31/10/20242003100
Investments30/11/20249804080
Investments31/12/20241004180
Movement on Investment30/04/202460 
Movement on Investment31/05/202470 
Movement on Investment31/06/202445 
Movement on Investment30/07/202430 
Movement on Investment31/08/202460 
Movement on Investment30/09/202465 
Movement on Investment31/10/202440 
Movement on Investment30/11/202420 
Movement on Investment31/12/202410 

 

Table2         
CategoryAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember
Investments (Rolling_Amount)6008002000290034002900310040804180
Monthly Difference 2001200900500-500200980100
Movement on Investment607045306065402010
Cash Movement 1301155870440-43516096090

 

Thanks in advance for your help!

2 ACCEPTED SOLUTIONS
johnt75
Super User
Super User

Make sure you have a date table, marked as a date table, linked to your Posting Date column in a one-to-many single direction relationship.

You can then create measures like

Rolling Amount =
VAR MaxDate =
    MAX ( 'Date'[Date] )
VAR Result =
    CALCULATE (
        SUM ( 'Table'[Amount] ),
        'Date'[Date] <= MaxDate,
        'Table'[Category] = "Investments"
    )
RETURN
    Result

The monthly difference is just the sum of the amount column

Monthly difference =
CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Category] = "Investments" )

and the cash movement would be

Cash Movement =
[Monthly Difference]
    - CALCULATE (
        SUM ( 'Table'[Amount] ),
        'Table'[Category] = "Movement on investment"
    )

View solution in original post

danextian
Super User
Super User

Hi @RichOB 

Try this calc column

Rolling Invesments = 
IF (
    'Table'[Category] = "Investments",
    CALCULATE (
        SUM ( 'Table'[Amount] ),
        FILTER (
            'Table',
            'Table'[Category] = "Investments"
                && 'Table'[Posting_Date] <= EARLIER ( 'Table'[Posting_Date] )
        )
    )
)

danextian_0-1745412496422.png

But you can actually do this with measures

danextian_1-1745412621460.png

What I dont get is for September, your cash movement is -435 when -500-65 = -565

 

Please see the attached sample pbix for the details.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

7 REPLIES 7
v-echaithra
Community Support
Community Support

Hi @RichOB ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Chaithra.

v-echaithra
Community Support
Community Support

Hi @RichOB ,

We wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Chaithra.

v-echaithra
Community Support
Community Support

Hi @RichOB ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Chaithra.

danextian
Super User
Super User

Hi @RichOB 

Try this calc column

Rolling Invesments = 
IF (
    'Table'[Category] = "Investments",
    CALCULATE (
        SUM ( 'Table'[Amount] ),
        FILTER (
            'Table',
            'Table'[Category] = "Investments"
                && 'Table'[Posting_Date] <= EARLIER ( 'Table'[Posting_Date] )
        )
    )
)

danextian_0-1745412496422.png

But you can actually do this with measures

danextian_1-1745412621460.png

What I dont get is for September, your cash movement is -435 when -500-65 = -565

 

Please see the attached sample pbix for the details.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
johnt75
Super User
Super User

Make sure you have a date table, marked as a date table, linked to your Posting Date column in a one-to-many single direction relationship.

You can then create measures like

Rolling Amount =
VAR MaxDate =
    MAX ( 'Date'[Date] )
VAR Result =
    CALCULATE (
        SUM ( 'Table'[Amount] ),
        'Date'[Date] <= MaxDate,
        'Table'[Category] = "Investments"
    )
RETURN
    Result

The monthly difference is just the sum of the amount column

Monthly difference =
CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Category] = "Investments" )

and the cash movement would be

Cash Movement =
[Monthly Difference]
    - CALCULATE (
        SUM ( 'Table'[Amount] ),
        'Table'[Category] = "Movement on investment"
    )
Akash_Varuna
Community Champion
Community Champion

Hi @RichOB Could you follow these 

  1. Use the existing Rolling_Amount column from Table1 in your matrix.

  2. Create a Monthly_Difference measure: CurrentMonth - PreviousMonth using the DATEADD function.

  3. Create a Cash_Movement measure: Monthly_Difference - Movement on Investment.

  4. Add a matrix visual with rows as Category, columns as months, and values as Rolling_Amount, Monthly_Difference, and Cash_Movement.

Hi @Akash_Varuna I don't have an existing Rolling_Amount column from Table 1, that's what I need help with. Your other steps, 2,3 and 4 are doable after the Rolling_Amoutn column is created.

 

Thanks

Helpful resources

Announcements
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.