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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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