March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello I would like to obtain this result
I want to make a cumulative sum each in relation to my previous value, my base value is that of B
index | A | B |
1 | 10 | 15 |
2 | 20 | =15+20=35 |
3 | 30 | =35+30=65 |
4 | 40 | =65+40=105 |
Result:
Index | A | B |
1 | 10 | 15 |
2 | 20 | 35 |
3 | 30 | 65 |
4 | 40 | 105 |
Solved! Go to Solution.
Hi @Lebron45 ,
powerbidev123's reply could return the result you want. However if A1 is not 10, it will not work. I don't suggest you to use EARLIER() function, it may cause bad performance if you have large size of data.
You can also try my code to create a calculated column.
B =
VAR _B1 = 15
VAR _CurrentIndex = 'Table'[index]
RETURN
IF (
'Table'[index] = 1,
_B1,
_B1
+ CALCULATE (
SUM ( 'Table'[A] ),
FILTER ( 'Table', 'Table'[index] > 1 && 'Table'[index] <= _CurrentIndex )
)
)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Lebron45 ,
powerbidev123's reply could return the result you want. However if A1 is not 10, it will not work. I don't suggest you to use EARLIER() function, it may cause bad performance if you have large size of data.
You can also try my code to create a calculated column.
B =
VAR _B1 = 15
VAR _CurrentIndex = 'Table'[index]
RETURN
IF (
'Table'[index] = 1,
_B1,
_B1
+ CALCULATE (
SUM ( 'Table'[A] ),
FILTER ( 'Table', 'Table'[index] > 1 && 'Table'[index] <= _CurrentIndex )
)
)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Lebron45 , Let me know if this helps
@Lebron45 , Try using
Cumulative B =
CALCULATE(
SUM(test[A]),
FILTER(
ALL(test),
test[Index] <= MAX(test[Index])
)
) + MIN(test[B])
Proud to be a Super User! |
|
@Lebron45 , Try using
B =
IF (
test[Index] = 1,
test[B],
test[A] +
CALCULATE(
MAX(test[B]),
FILTER(
test,
test[Index] = EARLIER(test[Index]) - 1
)
)
)
Proud to be a Super User! |
|
hi @bhanu_gautam thank you for your feedback, but I would like to fill my column B from the second and each time by making my value from the current line of my column A + my last value from the previous line of column B
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
91 | |
74 | |
58 | |
53 |
User | Count |
---|---|
196 | |
116 | |
107 | |
67 | |
64 |