Forum Discussion

rschaudhr's avatar
rschaudhr
Resolver II
5 years ago
Solved

Default value when no filter selected

I have a case where I have the following data:   There is a slicer based on the department. When Finance is selected in the slicer, another visual will display the comments related to finance...
  • MFelix's avatar
    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"
            )
        )
    )

     

     

  • rschaudhr's avatar
    rschaudhr
    5 years ago

    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.