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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Running total based on multiple column

Hi Team,

 

Please help me on Running total calculation based on multiple columns as a slicers.

 

Please find the below data for your referance.

NIHA3141_1-1663590549354.png

 

If I select HEAD as A, need output below.

NIHA3141_2-1663590626895.png

If I select HEAD as A and YEAR as 2023, need output below.

NIHA3141_3-1663590700660.png

 

If I select HEAD as A, Category as C1 and Org as HR then Expecting below out.

NIHA3141_4-1663590748633.png

 

Thank you,

@amitchandak , @daXtreme @Greg_Deckler @Fowmy @tamerj1 @Jihwan_Kim 

 

1 ACCEPTED SOLUTION

@Anonymous So you will never had a Value that is less than a "previous" row? If that is the case then you could do this:

Measure = 
  VAR __Value = MAX('Table'[Value])
  VAR __Table = FILTER(ALLSELECTED('Table'),[Value] <= __Value)
RETURN
  SUMX(__Table,[Value])


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

6 REPLIES 6
Greg_Deckler
Community Champion
Community Champion

@Anonymous You are going to need an Index or Date column to allow you to define "before".



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...
Anonymous
Not applicable

Hi @Greg_Deckler 

I am fine with Value column as INDEX,

 

Thank you.

@Anonymous So you will never had a Value that is less than a "previous" row? If that is the case then you could do this:

Measure = 
  VAR __Value = MAX('Table'[Value])
  VAR __Table = FILTER(ALLSELECTED('Table'),[Value] <= __Value)
RETURN
  SUMX(__Table,[Value])


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...
Anonymous
Not applicable

Thank you so much @Greg_Deckler  for your support.

 

Logic is woking fine but, if previous row value currerent row value same then it is getting wrong running total number.

There is chanse previous row value currerent row value same

Please help me on this 🙂

NIHA3141_0-1663592616058.png

 

@Anonymous

And, hence, why you need an Index or Date column. No way to solve it if values can be equal or a subsequent value is less than the current value. Just add an Index column in Power Query. Otherwise, you are stuck with a DAX index:

https://community.powerbi.com/t5/Quick-Measures-Gallery/The-Mythical-DAX-Index/m-p/1093214#M528



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...
Anonymous
Not applicable

Thank you, I will create INDEX column. 🙂

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.