Forum Discussion

RichOB's avatar
RichOB
Icon for Post Partisan rankPost Partisan
1 year ago
Solved

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 Rol...
  • johnt75's avatar
    1 year ago

    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"
        )
    
  • danextian's avatar
    1 year ago

    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] )
            )
        )
    )
    

    But you can actually do this with measures

    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.