Forum Discussion

PowerrrBrrr's avatar
PowerrrBrrr
Helper III
4 years ago
Solved

Filter not working as expected

I have below which for some reason gives me (Blank) even if there is no selection made. Selection is made by clicking on a different cards visual in the report. So if there is no card selected it should give me "No Id Selected"  but instead it gives me "Selected ID:"
What is wrong with below DAX?

 

Selected Pump = IF(
ISFILTERED(Class[Id]),"Selected ID:"
SELECTEDVALUE(Class[Id]),"No Id Selected"
)
  • Hi PowerrrBrrr ,

     

    According to your description, I have done tests that show the results very well, with the following reference.

    M_ = 
    IF (
        ISFILTERED ( Class[ID] ),
        "Selected ID:" & SELECTEDVALUE ( Class[ID] ),
        "No Id Selected"
    )


    If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


    Best Regards,
    Henry


    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Hi PowerrrBrrr ,

     

    I reproduced your problem and it is the filter condition in Filters that is causing the problem.

     

    Remove the fields from Filter on all pages and filter directly by slicer. Refer to the following.

     


    Best Regards,
    Henry


    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

7 Replies

  • PowerrrBrrr , Hope you have joined strings with &

    Selected Pump = IF(
    ISFILTERED(Class[Id]),"Selected ID:" & SELECTEDVALUE(Class[Id]),"No Id Selected"
    )

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Community Support

    Hi PowerrrBrrr ,

     

    According to your description, I have done tests that show the results very well, with the following reference.

    M_ = 
    IF (
        ISFILTERED ( Class[ID] ),
        "Selected ID:" & SELECTEDVALUE ( Class[ID] ),
        "No Id Selected"
    )


    If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


    Best Regards,
    Henry


    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • PowerrrBrrr's avatar
      PowerrrBrrr
      Helper III

      Hi v-henryk-mstf 

      I did your way and its still not working..there is no error. please see the below screen shot. I have not selected anything, still its takes the first condition in filter

       

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Community Support

    Hi PowerrrBrrr ,

     

    I reproduced your problem and it is the filter condition in Filters that is causing the problem.

     

    Remove the fields from Filter on all pages and filter directly by slicer. Refer to the following.

     


    Best Regards,
    Henry


    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • PowerrrBrrr's avatar
      PowerrrBrrr
      Helper III

      Yes that works, but would like to know why this does not work with Filter on Pages??I am here just cleaning the data and removing blank

      • v-henryk-mstf's avatar
        v-henryk-mstf
        Community Support

        Hi PowerrrBrrr ,

         

        ISFILTERED function is to return TRUE when the specified table or column is directly filtered, otherwise it returns FALSE. when the data or blank in Filter is not cleared, the judgment condition will still be in effect. This is the cause of the error.


        Best Regards,
        Henry


        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.