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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
rschaudhr
Resolver II
Resolver II

Default value when no filter selected

I have a case where I have the following data:

 

rschaudhr_0-1620942553404.png

There is a slicer based on the department. When Finance is selected in the slicer, another visual will display the comments related to finance. However, when no value is selected in the department slicer, the comments visual should show comments from Investment department.

 

Thank you,

 

Rehan 

2 ACCEPTED SOLUTIONS
MFelix
Super User
Super User

Hi @rschaudhr,

 

You should use a measure similar to the one below:

 

Comments selection =
IF (
    ISFILTERED ( CommentsTable[Department] ),
    SELECTEDVALUE ( CommentsTable[Comments] ),
    CALCULATE (
        SELECTEDVALUE ( CommentsTable[Comments] ),
        FILTER (
            ALL ( CommentsTable[Department], CommentsTable[Comments] ),
            CommentsTable[Department] = "Investments"
        )
    )
)

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

Hi @MFelix ,

 

Thank you! It works very well. I should have mentioned earlier. This dax code very works well when you just select one department or there is no selection. It does not work when you select multiple selection. Is there a way to do that?

 

Thank you again for your help.

 

 

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi @rschaudhr ,

 

You will need to create a independed department table and use it as slicer.

slicer = DISTINCT('Table'[DEP])

Then create a measure as below and add it to visual filter.

Measure = IF(ISFILTERED(slicer[DEP]),IF(SELECTEDVALUE('Table'[DEP]) in VALUES(slicer[DEP]),1,0),IF(SELECTEDVALUE('Table'[DEP])="INV",1,0))

2.PNG

3.PNG

 

Best Regards,

Jay

@Anonymous , Thank you! This work very well. 

MFelix
Super User
Super User

Hi @rschaudhr,

 

You should use a measure similar to the one below:

 

Comments selection =
IF (
    ISFILTERED ( CommentsTable[Department] ),
    SELECTEDVALUE ( CommentsTable[Comments] ),
    CALCULATE (
        SELECTEDVALUE ( CommentsTable[Comments] ),
        FILTER (
            ALL ( CommentsTable[Department], CommentsTable[Comments] ),
            CommentsTable[Department] = "Investments"
        )
    )
)

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix ,

 

Thank you! It works very well. I should have mentioned earlier. This dax code very works well when you just select one department or there is no selection. It does not work when you select multiple selection. Is there a way to do that?

 

Thank you again for your help.

 

 

Hi @rschaudhr ,

 

What do you want when more than one is selected on the slicer? All of the values or just the first one?

 

If you want to concatenate all the values then you should use somethig similar to this one:

 

Comments selection = 
IF (
    ISFILTERED ( CommentsTable[Department] ),
    CONCATENATEX(ALLSELECTED(CommentsTable[Comments],CommentsTable[Department]), CommentsTable[Comments], "/"),
    CALCULATE (
        SELECTEDVALUE ( CommentsTable[Comments] ),
        FILTER (
            ALL ( CommentsTable[Department], CommentsTable[Comments] ),
            CommentsTable[Department] = "Investments"
        )
    )
)

 

Be aware that this gives you a text value with all the comments selected also if you have all the values selected on your slicer what works is the last syntax does not return only the Investment.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



@MFelix ,

 

So below are a few senario:

 

1) when no filter is selected in department slicer, only investment comment will show.

2) when HR filter is selected in department slicer, only HR comment will show.

3) when HR and IT filter is selected in department slicer, then HR and IT comments will show.

4) when HR, IT and Operation filter is selected in department slicer, then HR, IT and operation comments will show. 

5) when All filter is selected in department slicer, then all comment will show.

 

I hope these senarios help.

 

Thank you!

Correct for all of them.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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