Forum Discussion

rp2022's avatar
rp2022
Helper II
2 years ago
Solved

Running Total / Cummulative totals

Input:  Label Date M P $ PD 3/2/2024 4406 S7 -100 PD 3/3/2024 5102 S7 100 PD 3/4/2024 6181 S0 200 PD 3/5/2024 7161 S0 500 PD 3/6/2024 7385 S0 -300 PD 3/...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi rp2022 ,

    Please create a new calculated column:

    Group = 
    VAR __cur_label = 'Table'[Label]
    VAR __group = IF(ISERROR(VALUE(__cur_label)),__cur_label,"Date")
    RETURN
    __group

    And then please create a new measure:

    Running Total = 
    VAR __group = MAX('Table'[Group])
    VAR __cur_date = MAX('Table'[Date])
    VAR __result = CALCULATE(SUM('Table'[$]),FILTER(ALLSELECTED('Table'),'Table'[Group]=__group && 'Table'[Date]<=__cur_date))
    RETURN
    __result

    Output:

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group