Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount 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.