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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

DAX If statement based on selected filter

Hello,

 

is it possible to reference a filter using a DAX formula?

e.g. IF (Filter = "Selcet All",1,2)

 

Thanks for your help

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @Anonymous 

You can do something like this, where you are comparing the total number of items in the column used to the number selected in the filter:

IF (
    COUNTROWS ( DISTINCT ( FilterTable[FilterColumn] ) ) = COUNTROWS ( ALL ( FilterTable[FilterColumn] ) ),
    1,
    2
)

Please mark the question solved when we get to the solution and consider kudoing if posts are helpful.

Cheers  Datanaut

View solution in original post

1 REPLY 1
AlB
Community Champion
Community Champion

Hi @Anonymous 

You can do something like this, where you are comparing the total number of items in the column used to the number selected in the filter:

IF (
    COUNTROWS ( DISTINCT ( FilterTable[FilterColumn] ) ) = COUNTROWS ( ALL ( FilterTable[FilterColumn] ) ),
    1,
    2
)

Please mark the question solved when we get to the solution and consider kudoing if posts are helpful.

Cheers  Datanaut

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors