Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi Dudes.
I need calculate running total and filter the top 3 items for each sub category.
Everything was running ok, but.. Sunddely the users requieres remove a product through a filter i.e. "Is not" command into the filter pane in power bi.
Then, the total has a stranged behavior and it has taken all my week and i don´t undestand what is happend, could you help me.
i.e
The Next Table everything is ok, but, when the "itemtoshow" is applied the running total change from this:
To this
if the upc filtered is deleted every thing returns to be ok but the running total is incorrect because still contains the value of the upc that has to be filtered
My fomula for running totals is:
Ruuning Totals=
Solved! Go to Solution.
Hi @Khristian ,
The issue you're describing occurs due to how filters interact with your calculations, particularly with ALL and ALLSELECTED functions in Power BI. Here's an analysis and potential fixes for your running total issue when using the "Is not" filter:
Effect of the "Is Not" Filter:
Interactions Between Measures:
Modify your Running Totals measure to account for filtered items explicitly. Replace ALL with a more selective filtering approach, like REMOVEFILTERS or explicitly excluding the field being filtered.
Example:
Running Totals = VAR FilteredTable = SUMMARIZE( FILTER( General, General[Grupo Comercial] = "mercado" ), General[Grupo Comercial] ) RETURN SUMX( FilteredTable, CALCULATE( [Sell Out], REMOVEFILTERS(General[BRAND]) -- Removes brand filter but respects others ) )
This ensures that the measure respects filters applied to the brand, including "Is not."
Ensure the ranking logic excludes the filtered-out UPC values:
Ranking = RANKX( FILTER( ALLSELECTED(General[BRAND]), NOT General[UPC] IN VALUES(General[UPC]) -- Exclude filtered UPCs ), [ValueToRank] )
In ItemsToShow, include logic to handle excluded UPCs:
ItemsToShow = VAR TOPSELECCION = 'TOP Value'[TOP Value Value] VAR ORDEN = RANKX( FILTER( ALLSELECTED(General[BRAND]), NOT General[UPC] IN VALUES(General[UPC]) -- Exclude filtered UPCs ), [ValueToRank] ) RETURN IF( NOT ISBLANK([ValueToRank]), IF(ORDEN <= TOPSELECCION, 1, 0) )
Please mark this as solution if it helps you. Appreciate Kudos.
Hi @Khristian,
The issue arises because of the ALL function in your Ruuning Totals measure.
ALL removes filters applied to specific columns, including the exclusion filter for UPCs, which causes the measure to include values that should be filtered out.
This behavior creates inconsistencies when filtering out specific UPCs.
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 give "Kudos"
Regards,
Vinay Pabbu
Hi @Khristian ,
The issue you're describing occurs due to how filters interact with your calculations, particularly with ALL and ALLSELECTED functions in Power BI. Here's an analysis and potential fixes for your running total issue when using the "Is not" filter:
Effect of the "Is Not" Filter:
Interactions Between Measures:
Modify your Running Totals measure to account for filtered items explicitly. Replace ALL with a more selective filtering approach, like REMOVEFILTERS or explicitly excluding the field being filtered.
Example:
Running Totals = VAR FilteredTable = SUMMARIZE( FILTER( General, General[Grupo Comercial] = "mercado" ), General[Grupo Comercial] ) RETURN SUMX( FilteredTable, CALCULATE( [Sell Out], REMOVEFILTERS(General[BRAND]) -- Removes brand filter but respects others ) )
This ensures that the measure respects filters applied to the brand, including "Is not."
Ensure the ranking logic excludes the filtered-out UPC values:
Ranking = RANKX( FILTER( ALLSELECTED(General[BRAND]), NOT General[UPC] IN VALUES(General[UPC]) -- Exclude filtered UPCs ), [ValueToRank] )
In ItemsToShow, include logic to handle excluded UPCs:
ItemsToShow = VAR TOPSELECCION = 'TOP Value'[TOP Value Value] VAR ORDEN = RANKX( FILTER( ALLSELECTED(General[BRAND]), NOT General[UPC] IN VALUES(General[UPC]) -- Exclude filtered UPCs ), [ValueToRank] ) RETURN IF( NOT ISBLANK([ValueToRank]), IF(ORDEN <= TOPSELECCION, 1, 0) )
Please mark this as solution if it helps you. Appreciate Kudos.
Thanks @FarhanJeelani you ar a Titan!..
However, i made some adjusments; but this line changed everthing
NOT General[UPC] IN VALUES(General[UPC])
The point, the running total was correct, but when the upc "isnot" filtered change.
I could not create this measure because into the table (Column) Brand could not found the upc column... take a look
so, i decided add "upc" into running totals, create a new measure to calculate the total of "isnot " filtered and substract it to the running totals... and wuala!...
Running Totals New=
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
79 | |
79 | |
59 | |
36 | |
33 |
User | Count |
---|---|
92 | |
59 | |
59 | |
49 | |
41 |