Forum Discussion

ENGFAKAYODE's avatar
ENGFAKAYODE
Icon for Helper I rankHelper I
4 years ago
Solved

Running Total per month

Hi All, I,ve been trying to get a running total from this table   I didnt get how the profit per month and I to get the running total per month restarting every year like this  Any help woul...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi ENGFAKAYODE ,

    I have created a simple sample, but I cannot upload the pbix file. Please refer to my steps.

    First, insert the codes.

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vc7JEYQwDETRXHyGxpKFllgo8k9jKJARc31lf/VxNO6km2zUlrYOc+ho53KzTWbeIT7ZJ+8i4D45Xg4Dv69185vVCOqVfpSGg0aVPXd0R7cqx8PGEK4w8c28G5yqnLxSXPOi2ulEnWGf2dO7DoRVPtkZnaueN/lvX6JgyGdeZhGf75TbRAN8jT5/", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [date = _t, Profit = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type date}, {"Profit", type number}})
    in
        #"Changed Type"

    Then create a year column.

    year = YEAR('Table'[date])

    Finally create a measure.

    Measure =
    CALCULATE (
        SUM ( 'Table'[Profit] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[year] = SELECTEDVALUE ( 'Table'[year] )
                && 'Table'[date] <= SELECTEDVALUE ( 'Table'[date] )
        )
    )
    

    Or a column.

    Column =
    CALCULATE (
        SUM ( 'Table'[Profit] ),
        FILTER (
            ( 'Table' ),
            'Table'[year] = EARLIER ( 'Table'[year] )
                && 'Table'[date] <= EARLIER ( 'Table'[date] )
        )
    )
    

     

    If I have misunderstood your meaning, please provide more details with your desired output and pbix file without privacy information.

     

    Best Regards

    Community Support Team _ Polly

     

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