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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
beginner_dax
Regular Visitor

Running Total not working due to Filter Pane

Hi everyone,

 

I am barely new to Power BI and I'm currently working on this Running Total calculation that is just not working for me.
The idea of it is to run sums ( %AVG ) on a 2-level matrix Order by SumAVG  and in Reverse. There is also a filter InMarkets on Filter Pane that whenever is applied it just messes with the calculation and it fixes when it's removed.

 

I've tried working with this idea I got from somewhere else but I can't seem to grasp the definitive solution (I couldn't find the link to show the source, I'm sorry...)

RT =
VAR Table1 =
    SELECTCOLUMNS (
        ALL 'FACT_TABLE'[MARKET_DSC] ),
        "PrcAVG, CALCULATE [%AVG] ),
        "Sorted" , CALCULATE [SumAVG] )
    )

VAR Table2 =
FILTER (
            T1 , [Sorted] >= CALCULATE [SumAVG] )
)

RETURN
SUMX (
             Table2,
             [PrcAVG]
)

 

This is the measure for SumAVG
Sumavg =
 SUMX (
    SUMMARIZECOLUMNS (
        'FACT_TABLE'[MARKET_DSC],
        'FACT_TABLE'[WEEK],
        "Average", [AVG_]
        ),
        [Average]
)


This is the measure for %AVG
%AVG =
VAR TotalGs =
CALCULATE [SumAVG],
                     ALLSELECTED 'FACT_TABLE'[MARKET_DSC],
                                              'FACT_TABLE'[WEEK] )
)

RETURN
 DIVIDE ( [SumAVG] , TotalGs , 0 )


I've tried using SUMX + WINDOW , RUNNINGSUM as a Visual Calculation, but I'm not getting anywhere either

SUMX (
             WINDOW (
                                1, abs ,
                                0, rel ,
                                ORDERBY ( [SumAVG] ,DESC )
             ) ,
               [%AVG]
)


I appreciate any help I can get on this, almost going crazy with it.
Screenshot_1.pngScreenshot_2.png
4 REPLIES 4
Anonymous
Not applicable

Hi,

Thanks for the solution Sahir_Maharaj  offered, and i want to offer some more information for user to refer to.

hello @beginner_dax , based on your code, do you want to accumulate the  [%AVG] by the [SumAVG] soring?

 

Best Regards!

Yolo Zhu

Hello @Anonymous . Indeed, I am trying to accumulate [%AVG] based on [SumAVG]. I believe the issue I'm coming across is the InMarkets in the Filter Pane, when it's applied then the calculation doesn't work.

beginner_dax
Regular Visitor

Hi @Sahir_Maharaj 

I tried the approach and got Resources Exceeded error. I tried narrowing the data but still getting the same result.

Sahir_Maharaj
Super User
Super User

Hello @beginner_dax,

 

Can you please try this approach:

RT = 
VAR CurrentMarket = MAX('FACT_TABLE'[MARKET_DSC])
VAR CurrentSumAVG = CALCULATE([SumAVG])

VAR FilteredTable =
    FILTER(
        ALLSELECTED('FACT_TABLE'),
        'FACT_TABLE'[MARKET_DSC] <= CurrentMarket
        && [SumAVG] >= CurrentSumAVG
    )

RETURN
SUMX(FilteredTable, [%AVG])

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.