Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
How to create a running total that follow the order of my chart?
This was done in Tableau. How to replicate it in PowerBI?
Solved! Go to Solution.
Hi @Alvin2013 ,
I suggest you to try code as below to create a measure.
Running Total Sort by Values =
VAR _SUMMARIZE =
SUMMARIZE ( ALL ( 'Table' ), 'Table'[Category], "Sum", SUM ( 'Table'[Value] ) )
VAR _ADDSORT =
ADDCOLUMNS ( _SUMMARIZE, "Sort", RANKX ( _SUMMARIZE, [Sum],, DESC, SKIP ) )
VAR _RUNNINGTOTAL =
ADDCOLUMNS (
_ADDSORT,
"Running Total", SUMX ( FILTER ( _ADDSORT, [Sort] <= EARLIER ( [Sort] ) ), [Sum] )
)
RETURN
SUMX (
FILTER ( _RUNNINGTOTAL, [Category] = MAX ( 'Table'[Category] ) ),
[Running Total]
)
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 @Alvin2013 ,
I suggest you to try code as below to create a measure.
Running Total Sort by Values =
VAR _SUMMARIZE =
SUMMARIZE ( ALL ( 'Table' ), 'Table'[Category], "Sum", SUM ( 'Table'[Value] ) )
VAR _ADDSORT =
ADDCOLUMNS ( _SUMMARIZE, "Sort", RANKX ( _SUMMARIZE, [Sum],, DESC, SKIP ) )
VAR _RUNNINGTOTAL =
ADDCOLUMNS (
_ADDSORT,
"Running Total", SUMX ( FILTER ( _ADDSORT, [Sort] <= EARLIER ( [Sort] ) ), [Sum] )
)
RETURN
SUMX (
FILTER ( _RUNNINGTOTAL, [Category] = MAX ( 'Table'[Category] ) ),
[Running Total]
)
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,
Share the download link of the PBI file.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.