Forum Discussion

KEB's avatar
KEB
Icon for Helper I rankHelper I
5 years ago
Solved

Sum rows <= current row index

Thank you for your help! I added an index to a dataset that I need to sum a column based on the previous rows in the index. Simply sums Days in rows where the Index is less than or equal to the current row index. 
Example: Index Row 6, a new column would show 15.66.

               Index Row 4 a new column would show 6.11.

Thank you for your time.

  • Hi KEB 

    Create a calculated column in your table:

    New col =
    CALCULATE (
        SUM ( Table1[Days] ),
        ALL ( Table1 ),
        Table1[Index] <= EARLIER ( Table1[Index] )
    )

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers 

     

4 Replies

    • KEB's avatar
      KEB
      Icon for Helper I rankHelper I

      ChrisMendoza I see that this solution worked for you, however for me it produced the the same value as Days and didn't sum. We found a calculated column that works so no further action is needed. I just wanted to followup with you and thank you for your time to help me. 

  • AlB's avatar
    AlB
    Icon for Community Champion rankCommunity Champion

    Hi KEB 

    Create a calculated column in your table:

    New col =
    CALCULATE (
        SUM ( Table1[Days] ),
        ALL ( Table1 ),
        Table1[Index] <= EARLIER ( Table1[Index] )
    )

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers