Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jmerdman
Frequent Visitor

How to use a filter or slicer from 4 columns with an "Or" versus "And"

I need to be able to filter or use a slicer that when I select one or more of the 4 columns listed below that it will show the data by using an "or". For example if I selected RX 2 & RX 3, that it will show me all of the data without a Null value for either column so that the expected results would show data for rows 2, 3, and 4

 

#RX 1 RX 2RX 3RX 4
1True  True
2  True 
3 TrueTrue 
4 True True
1 ACCEPTED SOLUTION

Thank you everyone. I ended up copying the table and then deleted all of the columns that I didn't need and kept the ID, Claim Number and the 4 Rx columns. I then highlighed those 4 Rx columns in Power Query Editor and right click an selected the "Unpivot Columns". I then created a small table with the 4 Rx values to use in the Slicer. I then created the relationships to the correct table and was able to create a Slicer that the user could use to select the data. 

View solution in original post

5 REPLIES 5
v-henryk-mstf
Community Support
Community Support

Hi @jmerdman ,

 

According to your description, you can refer to the following blog entry to create a dynamic selector for column selection

Then use the CONCATENATEX function to combine the contents of the selected column fields. Something like the following:

vhenrykmstf_0-1636709561707.png

 

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.

amitchandak
Super User
Super User

@jmerdman , for Or you needed independent tables for slicer values

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

 

Thank you everyone. I ended up copying the table and then deleted all of the columns that I didn't need and kept the ID, Claim Number and the 4 Rx columns. I then highlighed those 4 Rx columns in Power Query Editor and right click an selected the "Unpivot Columns". I then created a small table with the 4 Rx values to use in the Slicer. I then created the relationships to the correct table and was able to create a Slicer that the user could use to select the data. 

Hi @jmerdman ,

 

If it is feasible, could you provide detailed screenshots of the steps for my reference. I would appreciate it. Looking forward to your reply.😁


Best Regards,
Henry

 

Hi Henry,

 

Sorry it took me a bit to get back to this but below are the steps that I used that fixed my issue and allowed me to filter.

  1. Open up Report in Power BI Desktop
  2. Click on "Transform Data"
  3. Right clicked on the table that had the data that had the 4 columns and click "Copy". Then click "Paste". This will have created a duplicate table. You can rename your table.
  4. Then, click on "Choose Columns" in the toolbar so I could only have those 4 columns and then the unique key to tie it back to the orginial table.
    1.  jmerdman_0-1639769340134.png 
    2. uncheck the "Select All Columns"
    3. then select only the columns that you'd like to keep and click "OK"
  5. In the new table that you just created, select the columns that you'd like to "Unpivot" and then right click your mouse and click on the "Unpivot Columns" optionjmerdman_14-1639769914676.png
     
     

     

  6. This will then take the 4 columns of data and unpivot it to where the data in 4 columns converts to 2 columns (1 with the header and the other with the value in that field). In the screen shot below I've highlighted to Claim Keys that on the 4 columns that 2 had data in them and each row had a unique Claim Key now I had duplicate Claim Keys in this table which is perfect as it will tie to the other table as a 1 to many.  jmerdman_9-1639769815764.png

     

  7.  Click on the "Close & Apply"  jmerdman_16-1639770241887.png

     

  8. Then I went to "Model" and "Manage relationships" and created a relationship between the orginial table and the new table with the unpivoted data.   

     

    jmerdman_17-1639770474030.png

     

I was able to then add a filter from the new table and filter on the different values. Hope this helps.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.