Forum Discussion
Exact match text filter
Hello!
I have a Power BI report that contains 2 tables. The first, Customers, is a list of customer numbers (unique) and their account number. The second, Accounts, is a list of account numbers (unique) and the price of their subscription. I have a SELECTEDVALUE measure on Accounts[Price] that I use in card. The idea is that the user filters the Customers table using the customer number, which then returns a single row in Accounts (because of the 2-way relation on the account number) and the card shows the price.
The issue I have is that I need the user to enter the customer number in a textbox style filter. The ones I have found work as a contains filter, meaning that if they search for customer 12, then customers 123 and 124 are not filtered out. I've been trying to solve this in many ways in vein. Is there a way to filter on the exact value only? I've been toying with the idea of only keeping the minimum customer number when more than 1 are returned but could not make it work.
Thanks in advance!
What I ended up doing is change the source code of the Text Filter made by Microsoft. Somewhere in there, you can change the operator from "Contains" to "Is" and recompile the visual.
Sure!
First I downloaded the widget's source code from their repo here.
Then I installed pbiviz by following this tutorial.
Finally, I modified the source code. Here is a summary of the changes I made :
- in src/visuals.ts I changed the performSearch function to use the operator "Is" instead of "Contains"
- in pbiviz.json, I changed the name, display name and version
I then recompiled it using the pbiviz doc. It's been working quite well.
4 Replies
- amitchandakSuper User
BenjaminFernet , Based on what I got. The search option on the Normal slicer can work with a Text field. Yes, it do work only if select an exact value.
For search, you can use
Text Filter Slicer and how to search on Multiple columns: https://youtu.be/RbeZRJ3uAZE
- BenjaminFernetRegular Visitor
What I ended up doing is change the source code of the Text Filter made by Microsoft. Somewhere in there, you can change the operator from "Contains" to "Is" and recompile the visual.
- AnonymousNot applicable
could you please explain in details how to do this? I need the same Is.
Thank you!
- BenjaminFernetRegular Visitor
Sure!
First I downloaded the widget's source code from their repo here.
Then I installed pbiviz by following this tutorial.
Finally, I modified the source code. Here is a summary of the changes I made :
- in src/visuals.ts I changed the performSearch function to use the operator "Is" instead of "Contains"
- in pbiviz.json, I changed the name, display name and version
I then recompiled it using the pbiviz doc. It's been working quite well.