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
Rimson
Regular Visitor

Need some help with power bi

 

 

I have a table with the following layout

 

 

<id> / descr / color 1 / color 2 / color 3 / …

 

So for example

 

1 / Apple / Green / Red / Yellow

2/ Citrion / Geen / Yellow /

3/ Pepper / green / yellow / red

 

I would like to see all red items in a slicer

So that I can select the option “Red” and it would select

All items with

Or color 1 is red, OR color 2 is red, OR color 3 is red ?
how do I do this ?

1 ACCEPTED SOLUTION

If, in your data, you have "yellow" and "yellow " (with an extra space on the end) they will show up as seperate items.  You can do some TRIM and CLEAN on the color column in PowerQuery to clean that up.

View solution in original post

4 REPLIES 4
santhoshcheran
Advocate I
Advocate I

@Rimson  If selecting three column with the same color is your end game, try creating a new column with the logic

 

if(color 1 = "red", if(color 2 = "red", if(color 3 = "red", "red", 0),0),0)

 

Then use the new column as the slicer to filter the results

jdbuchanan71
Super User
Super User

Hello @Rimson 

In powerquery you can use the unpivot function to turn the columns of colors into a single column that you can use as a filter.

1. In the query editor select your color columns and go to Transform > Unpivot

unpivot1.jpg

Once you have that you can remove the attribute column, rename the value column and filter out blanks and you will end up with something list this:

Unpivot2.jpg

I have attached my sample file for you to look at.

 

Trying that out, in my visual tool I now have multiple instances of Yellow and Red to select from

If, in your data, you have "yellow" and "yellow " (with an extra space on the end) they will show up as seperate items.  You can do some TRIM and CLEAN on the color column in PowerQuery to clean that up.

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.