Forum Discussion

Sachin27031987's avatar
Sachin27031987
New Member
2 years ago
Solved

Running sum in a week

Hi Guys,  Please help me in getting running sum within a week (ignoring wholesaler). I need output column to get it from below table 

 

WholesalerWeekQtyOutput
A11035
B12025
C155
A22045
B22025
C255
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Sachin27031987 

     

    I have understood your needs, you need an Output column to calculate the cumulative data.

    I created a table using your data:

    Transform data > Add column > Index Column

    At this point, there will be a column of serial numbers in multiple places.

    Then create a calculated column:

    -------------------------------------------------------------------

    Output =

          SUMX(

                FILTER(

                    'Table',

                    'Table'[Index] >= EARLIER('Table'[Index]) && 'Table'[Week] = EARLIER('Table'[Week])

                ),

                'Table'[Qty]

            )

    -------------------------------------------------------------------

    This code uses the Filter function to filter from the bottom up, the Week column to set the range, and finally the SUMX function to iteratively aggregate.

    The result is as follow:

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Sachin27031987 

     

    I have understood your needs, you need an Output column to calculate the cumulative data.

    I created a table using your data:

    Transform data > Add column > Index Column

    At this point, there will be a column of serial numbers in multiple places.

    Then create a calculated column:

    -------------------------------------------------------------------

    Output =

          SUMX(

                FILTER(

                    'Table',

                    'Table'[Index] >= EARLIER('Table'[Index]) && 'Table'[Week] = EARLIER('Table'[Week])

                ),

                'Table'[Qty]

            )

    -------------------------------------------------------------------

    This code uses the Filter function to filter from the bottom up, the Week column to set the range, and finally the SUMX function to iteratively aggregate.

    The result is as follow: