Forum Discussion
Default value when no filter selected
- 5 years ago
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" ) ) )
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.