Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Running Total Not Working

Hi Folks,    I'm trying to get the running total for my tables with date and group filters.   Following is the DAX syntax I'm using but it is not giving the correct anwer, For Column,   Runni...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous ,

     

    If i understand you correctly, please modify "ALLEXCEPT(Data_2, Data_2[Group] ,Data_2[ReturnDate])" to "ALLEXCEPT(Data_2, Data_2[Group])".

    For Column:

    Running_Total_C = 
    CALCULATE (
        SUM ( Data_2[P1Log_Ret] ),
        FILTER (
            ALLEXCEPT ( Data_2, Data_2[Group] ),
            Data_2[ReturnDate] <= EARLIER ( Data_2[ReturnDate] )
        )
    )

    For Measure:

    Running_Total_M = 
    CALCULATE (
        SUM ( Data_2[P1Log_Ret] ),
        FILTER (
            ALLEXCEPT ( Data_2, Data_2[Group] ),
            Data_2[ReturnDate] <= SELECTEDVALUE ( Data_2[ReturnDate] )
        )
    )

    Result would be shown as below:

    BTW, if you want to calculate Running Total per month, please refer to the formula below.

    Running_Total_monthly = 
    CALCULATE (
        SUM ( Data_2[P1Log_Ret] ),
        FILTER (
            ALLEXCEPT ( Data_2, Data_2[Group] ),
            Data_2[ReturnDate] <= EARLIER ( Data_2[ReturnDate] )
                && FORMAT ( Data_2[ReturnDate], "YYYYMM" )
                    = FORMAT ( EARLIER ( Data_2[ReturnDate] ), "YYYYMM" )
        )
    )

     

    Best Regards,

    Jay

    Community Support Team _ Jay Wang

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