Forum Discussion

Sudharshan1919's avatar
Sudharshan1919
Helper III
2 years ago
Solved

Multiple Combination selection using Slicer

Hi All,

I have a table named A where in, below values were present

 

Id      Region              Java                 Python             Unix                AgentsName
-----------------------------------------------------------------------------------------------
1      UK                       1                          0                    0                        Java
2      UK                       0                          1                    0                      Python
3      UK                       0                          0                    1                        Unix
4      UK                       1                          1                    0                  Java+Python
5      UK                       1                          0                    1                  Java+Unix
6      UK                       0                          1                    1                  Python+Unix

 

I also have a another table named B with the values like below

 

ListName        AgentName
--------------------------------
Unix                 Unix
Unix             Unix+Python
Unix             Unix+Java
Unix                   All
Java               Java
Java               Java+Unix
Java               Java+Python
Java               All
Python       Python
Python       Python+Unix
Python       Python+Java
Python       All

 

From the above table, in power bi..with the help of ListName column in Table B, i need the data to be filtered in Table A. I am using Slicer visual here and kept the ListName column from TableB. It must select all the combinations that are in Table A. That means, if i select Unix, then all the combinations that contain Unix must be shown, which are Java+Unix, Python+Unix, Unix+Python, Unix+Java, Unix, ALL.
Please help me to get et this achieved in Power BI

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Sudharshan1919 ,

    Please try below steps:

    1. create a measure with below dax formula

    Measure =
    VAR cur_lname =
        SELECTEDVALUE ( 'Table B'[ListName] )
    VAR cur_aname =
        SELECTEDVALUE ( 'Table A'[AgentsName] )
    VAR _val =
        IF ( CONTAINSSTRING ( cur_aname, cur_lname ), 1 )
    RETURN
        IF ( NOT ( ISFILTERED ( 'Table B'[ListName] ) ), 1, _val )
    

    2. add a table visual with Table A fields, add a sclicer with Table B [ListName], add the measure to the table visual filter pan and set

    Please refer the attached .pbix file.

     

    Best regards,
    Community Support Team_Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

    • Sudharshan1919's avatar
      Sudharshan1919
      Helper III

      Hello Idrissshatila ,

       

      I have already tried the approach that you have given, before posting this. But that couldnt satisfy my requirement. As you mentioned i have also used ListName column in the slicer, but when selecting the value in the slicer , in the below grid only the values that having that value are only being displayed. For example, if i select Unix... only Unix and All option are only displayed, but not able to display the combination values (Unix+Python, Unix+Java).
      Kindly help me for this..

       

      Thanks

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Sudharshan1919 ,

    Please try below steps:

    1. create a measure with below dax formula

    Measure =
    VAR cur_lname =
        SELECTEDVALUE ( 'Table B'[ListName] )
    VAR cur_aname =
        SELECTEDVALUE ( 'Table A'[AgentsName] )
    VAR _val =
        IF ( CONTAINSSTRING ( cur_aname, cur_lname ), 1 )
    RETURN
        IF ( NOT ( ISFILTERED ( 'Table B'[ListName] ) ), 1, _val )
    

    2. add a table visual with Table A fields, add a sclicer with Table B [ListName], add the measure to the table visual filter pan and set

    Please refer the attached .pbix file.

     

    Best regards,
    Community Support Team_Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.