Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

filter list if slicer is selected

Hello Community, 

 

I want to filter the list if isResponsible="Yes" if Org Unit slicer is selected, if not selected just display all value. I would appreciate any help. Thank you

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, Anonymous 

    Based on your description, I created the following sample data:

    First, I created a calculated table using the following DAX expression:

    Org = VALUES('Table'[Org name])

    Use this calculated table's columns in the slicer:

    After that I created a measure using the following DAX expression:

    MEASURE =
    VAR _seleted_org =
        SELECTCOLUMNS ( 'Org', 'Org'[Org name] )
    RETURN
        IF (
            HASONEFILTER ( 'Org'[Org name] ),
            IF (
                SELECTEDVALUE ( 'Table'[Org name] )
                    IN _seleted_org
                        && SELECTEDVALUE ( 'Table'[IsRespansible] ) = "Yes",
                1,
                0
            ),
            1
        )

    Use this metric in the filter panel of the table visual, setting a value of 1:

    As you'd expect, when the slicer doesn't select any value, the whole thing is shown. When I select any of these values, only the line with isResponsible="Yes is displayed:

    I have provided the PBIX file used this time below for your reference.

     

     

    Best Regards

    Jianpeng Li

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

     

     

     

     

     

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, Anonymous 

    Thank you very much for your reply. Based on the screenshots you provided, I made the following two tables:

    I used the following DAX expression:

    MEASURE =
    VAR _org_name_table =
        SELECTCOLUMNS ( 'Table', 'Table'[Org name] )
    RETURN
        IF (
            ISFILTERED ( 'Table'[Org name] ),
            IF (
                SELECTEDVALUE ( 'Table 2'[Org name] )
                    IN _org_name_table
                        && SELECTEDVALUE ( 'Table 2'[IsRespansible] ) = "Yes",
                1
            ),
            1
        )
    

    Here are the results:

    I've provided the PBIX file used this time below, and I hope my suggestions will help you.

     

     

     

    Best Regards

    Jianpeng Li

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

     

     

     

     

     

     

     

     

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, Anonymous 

    Based on your description, I created the following sample data:

    First, I created a calculated table using the following DAX expression:

    Org = VALUES('Table'[Org name])

    Use this calculated table's columns in the slicer:

    After that I created a measure using the following DAX expression:

    MEASURE =
    VAR _seleted_org =
        SELECTCOLUMNS ( 'Org', 'Org'[Org name] )
    RETURN
        IF (
            HASONEFILTER ( 'Org'[Org name] ),
            IF (
                SELECTEDVALUE ( 'Table'[Org name] )
                    IN _seleted_org
                        && SELECTEDVALUE ( 'Table'[IsRespansible] ) = "Yes",
                1,
                0
            ),
            1
        )

    Use this metric in the filter panel of the table visual, setting a value of 1:

    As you'd expect, when the slicer doesn't select any value, the whole thing is shown. When I select any of these values, only the line with isResponsible="Yes is displayed:

    I have provided the PBIX file used this time below for your reference.

     

     

    Best Regards

    Jianpeng Li

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

     

     

     

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Anonymous ,

       

      it's not working, this is the model design

       

      maybe you have some idea in this case. Thank you.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi, Anonymous 

        Thank you very much for your reply. Based on the screenshots you provided, I made the following two tables:

        I used the following DAX expression:

        MEASURE =
        VAR _org_name_table =
            SELECTCOLUMNS ( 'Table', 'Table'[Org name] )
        RETURN
            IF (
                ISFILTERED ( 'Table'[Org name] ),
                IF (
                    SELECTEDVALUE ( 'Table 2'[Org name] )
                        IN _org_name_table
                            && SELECTEDVALUE ( 'Table 2'[IsRespansible] ) = "Yes",
                    1
                ),
                1
            )
        

        Here are the results:

        I've provided the PBIX file used this time below, and I hope my suggestions will help you.

         

         

         

        Best Regards

        Jianpeng Li

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