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
Hi All,
Below is my data sample
I want to have result like this
I use this formula that the accumulation didn't work
Any support on this, highly appriciated.
Solved! Go to Solution.
Hi @Torbuzz ,
If you want to get result as your question, I think you need to sort your table by [Date] and [Name].
Measure:
GrandTotal = CALCULATE(SUM('Table'[In]) - SUM('Table'[Out]))
SisaStok =
VAR _Step1 =
SUMMARIZE (
ALLSELECTED ( 'Table' ),
'Table'[Index],
Kalender[Year],
Kalender[MonthSort],
'Table'[Name],
"GrandTotal", [GrandTotal],
"Group",
MAXX (
FILTER (
ALLSELECTED ( 'Table' ),
[GrandTotal] < 0
&& 'Table'[Index] < EARLIER ( 'Table'[Index] )
),
'Table'[Index]
)
)
VAR _Step2 =
ADDCOLUMNS (
_Step1,
"RunningTotal",
IF (
[GrandTotal] < 0,
0,
SUMX (
FILTER (
_Step1,
[Group] = EARLIER ( [Group] )
&& 'Table'[Index] <= EARLIER ( 'Table'[Index] )
),
[GrandTotal]
)
)
)
RETURN
SUMX ( FILTER ( _Step2, [Index] IN VALUES ( 'Table'[Index] ) ), [RunningTotal] )
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.
Now I change the formula to be like this :
What should I do?
Hi @Torbuzz ,
If you want to get result as your question, I think you need to sort your table by [Date] and [Name].
Measure:
GrandTotal = CALCULATE(SUM('Table'[In]) - SUM('Table'[Out]))
SisaStok =
VAR _Step1 =
SUMMARIZE (
ALLSELECTED ( 'Table' ),
'Table'[Index],
Kalender[Year],
Kalender[MonthSort],
'Table'[Name],
"GrandTotal", [GrandTotal],
"Group",
MAXX (
FILTER (
ALLSELECTED ( 'Table' ),
[GrandTotal] < 0
&& 'Table'[Index] < EARLIER ( 'Table'[Index] )
),
'Table'[Index]
)
)
VAR _Step2 =
ADDCOLUMNS (
_Step1,
"RunningTotal",
IF (
[GrandTotal] < 0,
0,
SUMX (
FILTER (
_Step1,
[Group] = EARLIER ( [Group] )
&& 'Table'[Index] <= EARLIER ( 'Table'[Index] )
),
[GrandTotal]
)
)
)
RETURN
SUMX ( FILTER ( _Step2, [Index] IN VALUES ( 'Table'[Index] ) ), [RunningTotal] )
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.
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 |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |