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
msl088
Frequent Visitor

Select column based on slicer

Hello,

 

I have a situation where I want to filter an entire table based on a slicer selection. I have created 7 different boolean columns that represent whether or not that row fulfills a series of conditions. Now I want to use a slicer to select which column I want to filter the table through. Is there any way to do that?

 

Thanks in advance for your help! 

10 REPLIES 10

Here's an example of what I want to do. I have this data table.

GKEYWEIGHTSIZE1234567
1234400040FALSEFALSEFALSEFALSEFALSETRUETRUE
6541350045FALSETRUETRUETRUETRUETRUETRUE
31201200020FALSEFALSEFALSEFALSEFALSEFALSEFALSE
6584420022FALSEFALSETRUETRUETRUETRUETRUE
2310630042FALSEFALSEFALSEFALSEFALSEFALSEFALSE
5168400020FALSEFALSEFALSEFALSEFALSEFALSETRUE
9841600040TRUETRUETRUETRUETRUETRUETRUE


And I have a stacked bar chart that I need to change through a slicer like this.

Capture.PNG

 

I think it's clearer now.

@msl088 as @nvprasad recommended, unpivot your table. Follow these steps

 

- transform data
- select GKey, Weight, Size columns
- right-click, unpivot other columns it will add two columns, attribute, and value, rename these as per your requirement
- close and apply

 

Now you can use attribute as a slicer, or what you renamed it to,

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.





Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k unfortunately when I do that I get an error saying that I cannot have multiple values of "gkey" since it is on the one side of a many-to-one relationship and is used as a primary key of the table.

Is there any other way to do that?

Hi,

Using the Query Editor, create a unique list of all Gkey's and related the unpivoted table and the other table to this new table with the unique list of all Gkeys.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

The problem is that the Gkey is also the primary key of the table, so I can't have multiple rows with the same Gkey, and unpivoting does that.

@msl088 so this is a larger modelling challenge, as @Ashish_Mathur  suggested, create a table with unique gkey column and then use that table to link to this unpvitoed table and also with other tables you have in the model.

 

Data modelling is key part of any BI report and this is exactly is what we need it here.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@msl088 not sure which table you are setting the relationship with and why you need that. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I have a separate table which I cannot change and it is related to this table through the gkey column on a many to one relationship. 

nvprasad
Solution Sage
Solution Sage

Hi,

 

In the power query editor do the unpivot transformation to get all 7 columns into the one column and their responses in the next column.

This way you can slice based on 7 columns.

Appreciate a Kudos! 🙂
If this helps and resolves the issue, please mark it as a Solution! 🙂

Regards,
N V Durga Prasad

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.