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

View all the Fabric Data Days sessions on demand. View schedule

Reply
ns29
Helper I
Helper I

Running Total - looking for a more elegant solution

I'm looking for a more elegant solution to set up a Total Run on the selected items. See the attached screenshot and sample file at the following link. In the sample file, on the running_total tab, you will see 2 arrays. The matrix on the right is what I ultimately need, the one on the left is to provide clarity on what I'm trying to achieve. For the measurement performance_running_total_selected,I basically want to start the total career from the age of 2. Is there a better or elegant way to do this than the hack in the highlighted part of the screenshot? Is it a different solution if the desired range over which the total execution should be made is continuous (between X and Y) versus the exclusion of specific selected ages?

Capture.PNG

https://drive.google.com/file/d/1ssR6Y40tEBuPARHfrVzDm5QJumz3g4y5/view?usp=sharing

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @ns29 ,

Try this:

RunningTotal = 
CALCULATE (
    SUM ( Table1[performance] ),
    FILTER (
        FILTER ( ALL ( Table1[age] ), Table1[age] >= 2 ),
        Table1[age] <= MAX ( Table1[age] )
    )
)

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

4 REPLIES 4
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try to create a What If parameter:

Parameter = GENERATESERIES(1, 24, 1)

Then try this measure:

performance_running_total_selected = 
CALCULATE(
	SUM('Table1'[performance]),
	FILTER(
		ALL('Table1'[age]),
		ISONORAFTER(IF([age]<=SELECTEDVALUE(Parameter[Parameter])-1,1000,[age]), MAX([age]), DESC)
	)
)

If you want to start from 2, when select '2' in parameter slicer, the result shows:

61.PNG

Here is the changed pbix file:

pbix 

 

Best Regards,

Giotto Zhi

Thanks for this - learning new things about Power BI every day!!!

danextian
Super User
Super User

Hi @ns29 ,

Try this:

RunningTotal = 
CALCULATE (
    SUM ( Table1[performance] ),
    FILTER (
        FILTER ( ALL ( Table1[age] ), Table1[age] >= 2 ),
        Table1[age] <= MAX ( Table1[age] )
    )
)

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thank you for the elegant solution!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors