Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreShape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.
Edits:
Is there a way to see how something would filter prior to actually filtering the object?
If I'm able to do that then I can make it a logic where if blank / no values go to the next item to check.
Original Post:
Hi right now I'm submitting the following search query via typescript utilizing the ITupleFilter action (which may be incorrect? not sure) in order to try and do one of two things...
Right now I'm gathering the data I need (column and table values) via the following loops
//This is in the public update(options: VisualUpdateOptions)function
const array = []
options.dataViews[0].metadata.columns.forEach(element => {
array.push(element)
});
this.myArray = array
// This portion is in a public performSearch(text: string) function
let testTarget: ITupleFilterTarget = []
this.myArray.forEach(element => {
if (element) {
testTarget.push({
table: element.queryName.substr(0, element.queryName.indexOf(".")),
column: element.queryName.substr(element.queryName.indexOf(".") + 1)
})
}
});
and putting it into a tuplefilter as such.
const isBlank = ((text || "") + "").match(/^\s*$/);
let filter: ITupleFilter = null;
let action = FilterAction.remove;
if (!isBlank) {
filter = {
$schema: "https://powerbi.com/product/schema#Tuple",
filterType: 6, //wtf??? FilterType.Tuple?? if this **bleep** works idfk man just.... https://community.powerbi.com/t5/Custom-Visuals-Development/Custom-Search-Visual/m-p/663749
operator: "In",
target: testTarget,
values: [[{value: text}]]
}
console.log("filter")
console.log(filter)
action = FilterAction.merge;
}
this.host.applyJsonFilter(filter, "general", "filter", action)
this.searchBox.property("value", text);
I'm noticing that if I have two data fields I can search the first but not the second.
Also there isn't a way to do this the "contains" operator is there?
Base of the code was provided from this repository https://github.com/microsoft/PowerBI-visuals-TextFilter/blob/master/src/visual.ts
thanks.
Solved! Go to Solution.
I found a way of doing it and will post the code on github. While it doesn't filter two columns at once it does allow me to filter based on the highest potential quantity of matches for the string of text against all column (so far just Int and string but this has worked for dates and hybrid text [v123]).
Sure thing, haven't figured out how to approach trying to get this merged into microsofts main branch.
Please let me know if you find any bugs.
https://github.com/gmmeyers/PowerBI-visuals-TextFilter
release to just upload to powerbi here.
https://github.com/gmmeyers/PowerBI-visuals-TextFilter/releases/tag/1.0.0
Hey @Merxvell, I am having the same filtering issue. Could you possibly share your github repository so I can see your approach?
Thanks.
Sure thing, haven't figured out how to approach trying to get this merged into microsofts main branch.
Please let me know if you find any bugs.
https://github.com/gmmeyers/PowerBI-visuals-TextFilter
release to just upload to powerbi here.
https://github.com/gmmeyers/PowerBI-visuals-TextFilter/releases/tag/1.0.0
Hi @Merxvell ,
Do you want to filter data from multiple fields at a time? Generally, a custom visual like Text Filter can only filter one field. Please check the link below to see if it can be an alternative solution to achieve your needs.
1. Create a calculated table and measure:
How to filter on multiple columns (check the post from Vvelarde )
2. Create hierarchy slicer:
Create filter from two columns
Power bi slicer multiple columns with examples
Best Regards
My wording was pretty trash after re-reading it. Ideally I'd like something like this in terms of step order (which I think I'm getting close to?)
I realized a tuplefilter was not what I needed but rather Advance filter. I'm close I just need to know how to see if the filter would return empty.
I found a way of doing it and will post the code on github. While it doesn't filter two columns at once it does allow me to filter based on the highest potential quantity of matches for the string of text against all column (so far just Int and string but this has worked for dates and hybrid text [v123]).
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Check out the November 2024 Power BI update to learn about new features.