Power BI: exclude the filter selection from the calculation
To calculate the values of the non-selected options of a slicer, there are few things to do before like to create a new table and a measure so I have this data and this simple visualization:
![]() |
![]() |
I will create a new table in order to extract the unique values of the “support” and “type” column:

NOTE:
- To know how, read Power BI: extract columns from a table to another one
- There is no relationship between my tables

I will create a measure with this formula:
var result=CALCULATE(COUNT('table1'[argument1]),KEEPFILTERS(EXCEPT(ALL('table1'[argument2]),ALLSELECTED('table2'[argument1])))) return IF(ISFILTERED('table2'[argument1]),result,COUNT('table1'[argument1]))

NOTE: change “table” and “argument” by yours
Now that I have everything set, I will create a slicer with the new table and add the measure in my visualization table:

If I select “cx”, the measure calculates everything except this selection:

If my slicer has multiple layers, I will have to use this formula:
var allexc1=EXCEPT(ALL('table1'[argument2]),ALLSELECTED('table2'[argument1])) var allexc2=EXCEPT(ALL('table1'[argument3]),ALLSELECTED('table2'[argument2])) var result=IF(ISFILTERED('table2'[newsupport]),CALCULATE(COUNT('table1'[argument1]),KEEPFILTERS(allexc1)),CALCULATE(COUNT('table1'[argument1]),KEEPFILTERS(allexc2))) return IF(ISFILTERED('table2'[argument1])||ISFILTERED('table2'[argument2]),result,COUNT('table1'[argument1]))



Now if I create a relationship, the formula will stop to work so to remediate it, I will include in the formula the CROSSFILTER function:


To make disappear the row of the selected filter, I will use this formula:
- For a single layer filter
IF(MAX('table1'[argument2]) in ALLSELECTED('table2'[argument1]) && COUNTROWS(ALLSELECTED('table2'[argument1]))<>COUNTROWS(ALL('table2'[argument1])),1,0)

- For a multiple layers filter
var allexc1=IF(MAX('table1'[support]) in ALLSELECTED('table2'[argument1]) && COUNTROWS(ALLSELECTED('table2'[argument1]))<>COUNTROWS(ALL('table2'[argument1])),1,0) var allexc2=IF(MAX('table1'[type]) in ALLSELECTED('table2'[argument2]) && COUNTROWS(ALLSELECTED('table2'[argument2]))<>COUNTROWS(ALL('table2'[argument2])),1,0) return IF(ISFILTERED('table2'[argument1]),allexc1,allexc2)

Once done, I will add it in my visualization table configured like that:
![]() |
![]() |
NOTE: if my visualization table has only the measure, there is no need for this trick

Interesting Topics
-
Be successfully certified ITIL 4 Managing Professional
Study, study and study, I couldn’t be successfully certified without studying it, if you are interested...
-
Be successfully certified ITIL 4 Strategic Leader
With my ITIL 4 Managing Professional certification (ITIL MP) in the pocket, it was time to go for the...
-
Hide visual and change background color based on selection
Some small tricks to customize the background colour of a text box...
-
Stacked and clustered column chart or double stacked column chart
In excel, I use a lot the combination of clustered and stacked chart...
-
Refresh Power BI
From the Power BI Service, I can set refresh but, for instance, there is no option to do it monthly or each time a change is made...
-
Power BI alerts to be sent by email from an excel file based on condition
I will explain how to send a list of emails from an excel file after creating alerts...