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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Diferentiate between all selected filter and clear filter

I am attempting to create a measure that displays the calculation for a default period if no filter is selected and just for the selected period if any dates are selected in the slicer filter.

 

This link has been very userful,

https://powerpivotpro.com/2018/12/setting-a-default-slicer-selection/

but there is a a edge case that does not behave as expected. In the situation where the select all is selected in the slicer, the measure returns the default period. That is because it seems that select all from the slicer filter works by clearing the selection, which makes select all and select nothing return the same value. I want my default filter to apply only when select nothing is true, but not when select all, in which case i want the actual filter to take over

Is there any workaround, or way of identifying which of the 2 conditions is true? I have also tried with ISFILTERED and also other functions but they all seem to behave the same.

Any help would be appreciated.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous,

Nope, Dax functions not able to find the difference between 'all select' and 'no select'. (they all have row contents of the whole table)

For your requirement, I'd like to suggest you refer to the following steps to check the selected status based on the related new calculated table.

1. Create a new calculated table with original table records and add a blank row to it and build a relationship('both' direction) based on the column which you wanted to use on a slicer.

 

Table2 =
UNION ( 'Table', { BLANK () } )

 

2. Write a measure with if statement to check different selected status: 

 

Select Status = 
VAR _countSelected =
    COUNTROWS ( ALLSELECTED ( 'Table'[Value] ) )
VAR _countAll =
    COUNTROWS ( ALL ( 'Table' ) )
VAR _countAllNonBlank =
    COUNTROWS ( ALLNOBLANKROW ( 'Table'[Value] ) )
RETURN
    IF (
        _countAll = _countSelected,
        "N",
        IF ( _countSelected <> _countAllNonBlank, "Y", "A" )
    )

 

Comment of measure status: 'N' mean 'no item select', 'Y' means 'item selected', 'A' means 'all item selected'.

3. Create a slicer with the column mentioned above and add a visual level filter to display 'not blank' records. (blank row not really existed in original table, it is append by related new calculated table)

6.png

Result:

81.gif

BTW, I also attached my test file below if you still confused about these steps.

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

HI @Anonymous,

Nope, Dax functions not able to find the difference between 'all select' and 'no select'. (they all have row contents of the whole table)

For your requirement, I'd like to suggest you refer to the following steps to check the selected status based on the related new calculated table.

1. Create a new calculated table with original table records and add a blank row to it and build a relationship('both' direction) based on the column which you wanted to use on a slicer.

 

Table2 =
UNION ( 'Table', { BLANK () } )

 

2. Write a measure with if statement to check different selected status: 

 

Select Status = 
VAR _countSelected =
    COUNTROWS ( ALLSELECTED ( 'Table'[Value] ) )
VAR _countAll =
    COUNTROWS ( ALL ( 'Table' ) )
VAR _countAllNonBlank =
    COUNTROWS ( ALLNOBLANKROW ( 'Table'[Value] ) )
RETURN
    IF (
        _countAll = _countSelected,
        "N",
        IF ( _countSelected <> _countAllNonBlank, "Y", "A" )
    )

 

Comment of measure status: 'N' mean 'no item select', 'Y' means 'item selected', 'A' means 'all item selected'.

3. Create a slicer with the column mentioned above and add a visual level filter to display 'not blank' records. (blank row not really existed in original table, it is append by related new calculated table)

6.png

Result:

81.gif

BTW, I also attached my test file below if you still confused about these steps.

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

Thank you for the reply. It is similar with what I had in mind, and you providing the answer, convinced me to tweak teh model to accomodate this design.

Unfortunately, there is no way to keep using the select all option wich the users would have loved, but I see no workaround based on current DAX functionlity as answered in this thread.

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @Anonymous,

 

I think from a DAX perspective there is no difference.

No matter if you select all or nothing, DAX will not filter by this column.

 

Regards,

Marcus

Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors