Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Sachin27031987
New Member

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
1 ACCEPTED SOLUTION
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:

vzhengdxumsft_0-1704445125928.pngvzhengdxumsft_1-1704445125929.png

Transform data > Add column > Index Column

vzhengdxumsft_2-1704445141809.png

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

vzhengdxumsft_3-1704445141810.png

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:

vzhengdxumsft_4-1704445234215.png

 

View solution in original post

1 REPLY 1
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:

vzhengdxumsft_0-1704445125928.pngvzhengdxumsft_1-1704445125929.png

Transform data > Add column > Index Column

vzhengdxumsft_2-1704445141809.png

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

vzhengdxumsft_3-1704445141810.png

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:

vzhengdxumsft_4-1704445234215.png

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors