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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
KEB
Helper I
Helper I

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.

Index Summing.png

Thank you for your time.

1 ACCEPTED SOLUTION
AlB
Super User
Super User

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 

SU18_powerbi_badge

 

View solution in original post

4 REPLIES 4
AlB
Super User
Super User

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 

SU18_powerbi_badge

 

@AlB Thank you so much. This works perfectly!

ChrisMendoza
Resident Rockstar
Resident Rockstar

@KEB -

Like this? Or do you require something different?

image.png






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



@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. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.