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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
KerwenZhang
Frequent Visitor

Sum from first line to current line

I have one column named "Result", 1 means success, 0 means fail. How should I calculate the total success count from frist line to current line? The final result should be like following:

Result  Total

1          1

0          1

1          2

1          3

0          3

 

2 ACCEPTED SOLUTIONS
themistoklis
Community Champion
Community Champion

@KerwenZhang

Running Total COLUMN =
CALCULATE (
    SUM ( 'Sheet1'[Values] ),
    ALL ( 'Sheet1' ),
    'Sheet1'[ID] <= EARLIER ( 'Sheet1'[ID] )
)

 

Lets say ID is the name of your first column and values is the second column 

View solution in original post

PattemManohar
Community Champion
Community Champion

@KerwenZhang Please add an Index column in "Power Query Editor" and then use the below logic in Data pane as New Column

 

Total = CALCULATE(SUM(Test158CummSum[Result]),FILTER(Test158CummSum,Test158CummSum[Index]<=EARLIER(Test158CummSum[Index])))

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




View solution in original post

2 REPLIES 2
PattemManohar
Community Champion
Community Champion

@KerwenZhang Please add an Index column in "Power Query Editor" and then use the below logic in Data pane as New Column

 

Total = CALCULATE(SUM(Test158CummSum[Result]),FILTER(Test158CummSum,Test158CummSum[Index]<=EARLIER(Test158CummSum[Index])))

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




themistoklis
Community Champion
Community Champion

@KerwenZhang

Running Total COLUMN =
CALCULATE (
    SUM ( 'Sheet1'[Values] ),
    ALL ( 'Sheet1' ),
    'Sheet1'[ID] <= EARLIER ( 'Sheet1'[ID] )
)

 

Lets say ID is the name of your first column and values is the second column 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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