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
Anonymous
Not applicable

Dynamic input a list of values and filter these (multiple) values in the same column

Hello,

 

I have a practical issue. In Tableau it is quite obvious how to solve, but difficult in Power BI (by the way, I searched the internet, this forum and many topics - I did not find a satisfactory answer) and I can use only Power BI (in Tableau is a dedicated filter).

 

Case description:

  • Power BI contains multiple visualizations using a table ('Products', 'Categories', 'Volume', others), as below but with >1000 rows. 
  • The user would like to see all values (all visualizations) based on the input (filter) .... and the input might look like list of values (strings) in the column 'Products' or 'Categories'. For example: user inputs P1, P2, P3.......(most likely ~100 values to enter at once, however the list depends on the current business need).

Question:

  • How to make this "dynamic input" of the list of values? (in theory it's most likely wildcard with many ORs but probably cannot be done in Power BI)
    • After the list of values is captured how to execute the actual filtering/matching within the column?

 

I checked possibility of using IN operator in DAX however I don't know if IN can be parametrizaied so user can input somewhere list of values and these values will be ingested into IN operator?

 

Maybe there is a solution to use R/Python script inside the visualization to capture list of values and match them with columns? In R it would be someting like datatable[Products %in% list_of_values,]

 

ProductsCategoriesVolume
P1A1
P2B2
P3C3
P4D1
P5A2
P6B3
P7C1
P8D2
P9A3
P10B1
P11C2
P12D3
P13A2
P14B2
P15C2
P16D3
P17A3
P18B3
P19C3
P20D3
P21A3
P22B3
P23C3
P24D3
P25A3
P26B3
P27C3
P28D3
P29A3
P30B3
12 REPLIES 12
PrabhavatiMali
Frequent Visitor

v-angzheng-msft
Community Support
Community Support

Hi, @Anonymous 

 

Try to use the search box of the slicer to quickly locate the filtered value, and then create a bookmark to record the unfiltered data status to clear the filter. Click the three-dot menu of the slicer to show the search box.

 

You can put multiple fields in the slicer to make the data easier to view and filter. You can either directly click to filter or search to locate the value. If you want to clear the filter, click the created bookmark to clear the filter to get all the data.

 

result like below:

vangzhengmsft_0-1629880440045.png

Please refer to the attachment below for details. Hope this helps.

 

Best Regards,
Community Support Team _ Zeon Zheng


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

Anonymous
Not applicable

Hello,

Thank you @v-angzheng-msft for this option. However, it will not solve the problem.

 

Please consider entering P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11 .... P30 at one (single paste of the whole list). Unfortunately you can filter one Px at the time or maybe there is a way to enter whole list so the engine will recognize and filter accordingly? 

 

In Tableau you can simply copy list of values from Excel and enter in the filter (custom value filter).

Hi, @Anonymous 

 

You can hold down Ctri and click to select multiple items, or you can turn off the multi-select with CTRL in the format pane, and then you can directly click to select multiple items.

vangzhengmsft_1-1630286748396.png

Hope this helps.

 

Best Regards,
Community Support Team _ Zeon Zheng


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

 

 

Anonymous
Not applicable

Hi @v-angzheng-msft,

 

thank you for an answer. However this is not solve the issue (in business practice).

 

The business case remains: how to paste list of values to Power BI filter field? =>

 

To be more specific:

  1. Please simulate table in Excel (as below)
    1. should contain 100,123 products (P1; P2; P3....P100,123)
  2. Then, in the filter field in Power BI, enter whole "Input list" (at once) so that the report is filtered according to the values from the input list.

Products:

ProductsCategoriesVolume
P1A1
P2B2
P3C3
P4D1
P5A2
P6B3
P7C1
P8D2
P9A3
P10B1
P11C2
P12D3
P13A2
P14B2
P15C2
P16D3
P17A3
P18B3
P100123B3

 


Input list:

P78
P94
P125
P198
P398
P598
P798
P998
P1198
P1398
P1598
P1798
P344
P417
P490
P563
P636
P709
P3198
P3398
P3598
P3798
P3998
P4198
P198
P271
P344
P417
P490
P5398
P5598
P5798
P5998
P6198
P6398
P6598
P6798
P3198
P5687
P8176
P125
P198
P271
P344
P417
P490
P563
P636
P709

P198
P198
P159
P179

Hi, @Anonymous 

 

This is also achievable, but it looks a little complicated.
You can create a calculated table that contains the values you want to filter, or you can filter the list directly on the measure.

_InputList = DATATABLE("product",STRING,{
{"P84"},{"P12"},{"P19"},{"P39"},{"P59"},{"P79"},{"P99"},{"P119"},{"P139"},{"P159"},
{"P179"},{"P34"},{"P41"},{"P49"},{"P56"},{"P63"},{"P70"},{"P31"},{"P39"},{"P35"},{"P37"},
{"P33"},{"P41"},{"P19"},{"P27"},{"P34"},{"P41"},{"P49"},{"P53"},{"P55"},{"P57"},{"P59"},{"P61"},{"P63"},
{"P65"},{"P67"},{"P31"},{"P56"},{"P81"},{"P125"},{"P19"},{"P27"},{"P34"},{"P41"},{"P49"},{"P56"},{"P63"},{"P70"},
{"P198"},{"P198"},{"P159"},{"P179"}
})

You may need other tools such as Excel to add quotes or quotes and commas to the filtered value string.
It looks like this:

vangzhengmsft_0-1630567380091.png

Then you can create a measure to determine whether it is the value you want to filter

_isIn = IF(MAX('Table'[Products])in VALUES(_InputList[product]),1,0)

or

_isIn2 = IF(MAX('Table'[Products]) in 
{
"P84","P12","P19","P39","P59","P79","P99","P119","P139","P159","P179","P34","P41","P49","P56","P63","P70","P31","P39","P35","P37",
"P33","P41","P19","P27","P34","P41","P49","P53","P55","P57","P59","P61","P63","P65","P67","P31","P81","P125","P19","P27","P34","P41","P49",
"P63","P70","P198","P198","P159","P179"
},1,0)

And then show items when measure is 1 in the filter pane.

vangzhengmsft_1-1630567906183.png

When you need to get a different filter result, just modify the value of the list.

 

Please refer to the attachment below for details. Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

 

Anonymous
Not applicable

Hi @v-angzheng-msft ,

 

thank you very much. Recently I have been thinking about this solution. I've tested it and works.

 

One item is still missing. Below, you hardcoded list of desited products in the "_InputList", but is there a way to parameterize "Value" parameter in the DATATABLE(), so we can avoid hardcoding inputlist and can take the inputlist from text field (example: text filter such as Power BI Text Filter)?   

_InputList = DATATABLE("product",STRING,{
{"P84"},{"P12"},{"P19"},{"P39"},{"P59"},{"P79"},{"P99"},{"P119"},{"P139"},{"P159"},
{"P179"},{"P34"},{"P41"},{"P49"},{"P56"},{"P63"},{"P70"},{"P31"},{"P39"},{"P35"},{"P37"},
{"P33"},{"P41"},{"P19"},{"P27"},{"P34"},{"P41"},{"P49"},{"P53"},{"P55"},{"P57"},{"P59"},{"P61"},{"P63"},
{"P65"},{"P67"},{"P31"},{"P56"},{"P81"},{"P125"},{"P19"},{"P27"},{"P34"},{"P41"},{"P49"},{"P56"},{"P63"},{"P70"},
{"P198"},{"P198"},{"P159"},{"P179"}
})

 

For example: 

Instead of hardcoding input list, an user will input a list into a particular text box on the dashboard:

 

 

"P84","P12","P19","P39"...

 

 

 

Higlighlted (blue) value to be parametrized:

 

{7F53CAC8-F9B9-45F4-95DF-517A4AE19246}.png.jpg.

Hi! Did you ever get this solved?

Anonymous
Not applicable

Unfortunately no.

 

parry2k
Super User
Super User

@Anonymous I think there are custom visuals for slicers that allow entering the values, please check at the marketplace.

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to 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.

Anonymous
Not applicable

@parry2k thank you for the answer. As far as I know slicer doesn't suppurt entering values. In this case the main issue is how to handle/enable user to enter multiple (e.g. ~100) values (e.g. strings) 😞

parry2k
Super User
Super User

@Anonymous the best is to create dimension table for each of selection, let's say you have two more tables, one with all the product and 2nd with all the categories (both tables contains unique values) and have a relationship with you main table, it will be 1 to many.

 

create a slicer from these new tables where users will select the values, visuals will update based on the selection. 

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to 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.

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.