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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jc173
Frequent Visitor

Sum Row value with previous value based on a index column

I guys, i have a table lake this

Datavalueindex
x101
x302
x603

 i want create another column with this logic

datavalueindexcalculateresult
 1011010
 30210+30=4040
 60340+60=100100
 204100+20=120120

i try this solution and works for power bi desktop 

CALCULATE(SUM('Table3'[Value]),FILTER('Table3','Table3'[index]<=EARLIER('Table3'[index])))

but when i create on web version of power by the earlier function give me 'dax earlier parameter is not the correct type'

Reading online i understood that earlier shouldn't be used in this situation, but i can't transform my dax expression to make it work differently, could you give me some advice?

 

2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

@jc173 Nope. Previous Value (“Recursion”) in DAX - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Anonymous
Not applicable

Hi @lbendlin ,

 

I modified my formula, you can try calculated column or measure like below:

Measure = 
var cur = MAX('Table'[index])
return 
SUMX(FILTER(ALL('Table'),'Table'[index] <= cur),'Table'[value])
Column = 
var cur = 'Table'[index]
return
SUMX (
    FILTER ( 'Table', 'Table'[index] <= cur ),
    'Table'[value]
)

vkongfanfmsft_0-1707186601544.png

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @lbendlin ,

 

I modified my formula, you can try calculated column or measure like below:

Measure = 
var cur = MAX('Table'[index])
return 
SUMX(FILTER(ALL('Table'),'Table'[index] <= cur),'Table'[value])
Column = 
var cur = 'Table'[index]
return
SUMX (
    FILTER ( 'Table', 'Table'[index] <= cur ),
    'Table'[value]
)

vkongfanfmsft_0-1707186601544.png

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @jc173 ,

 

You can try formula like below:

Column =
SUMX (
    FILTER ( 'Table', 'Table'[index] <= EARLIER ( 'Table'[index] ) ),
    'Table'[value]
)

vkongfanfmsft_0-1707184665709.png

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

stop it with the EARLIER already, that is not good advice.  

 

This is a running total that can be covered via quick measures.

Greg_Deckler
Community Champion
Community Champion

@jc173 Nope. Previous Value (“Recursion”) in DAX - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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