Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I want to create a Filter for a value entered by the users.
I want to use the Contains operator of the AdvancedFilter to perform fuzzy searches.
For example, if the data contains [aaa,bbb,ccc,ddd,eee,abd,def],
If the user enters [a], [aaa,abd] will be returned.
Also, if the user enters [a,d], [aaa,ddd,abd,def] will be returned.
I was able to create up to the above behavior.
However, if more than three values are entered, the operation will not work as expected.
For example, if the users enters [a,c,d], I want to search in the form (a OR c) OR (c OR d).
I expect [aaa,cccc,ddd,abd,def] to be returned.
In the case of the following code, I believe that only [abd,ccc] is returned, and that it is adapting in the form (a OR c) AND (c OR d).
can you give me some good advice?
Sorry for the bad English, but thank you in advance.
visual.ts
public update(options: VisualUpdateOptions) {
this.events.renderingStarted(options);
this.formattingSettings = this.formattingSettingsService.populateFormattingSettingsModel(TextFilterSettingsModel, options.dataViews[0]);
const metadata = options.dataViews && options.dataViews[0] && options.dataViews[0].metadata;
const newColumn = metadata && metadata.columns && metadata.columns[0];
let searchText = "";
if (options.dataViews && options.dataViews.length > 0 && this.column && (!newColumn || this.column.queryName !== newColumn.queryName)) {
this.performSearch("");
} else if (options?.jsonFilters?.length > 0) {
searchText = `${(<IAdvancedFilter[]>options.jsonFilters).map((f) => f.conditions.map((c) => c.value)).join(" ")}`;
}
this.searchBox.property("value", searchText);
this.column = newColumn;
this.events.renderingFinished(options);
}
public performSearch(text: string) {
const values = text.split("\n");
if (this.column) {
const target = {
table: this.column.queryName.substr(0, this.column.queryName.indexOf(".")),
column: this.column.queryName.substr(this.column.queryName.indexOf(".") + 1)
};
let filters= [];
if (values.length > 1) {
for (let i = 0; i < values.length - 1; i++) {
const filter = new AdvancedFilter (
target,
"Or",
{
operator: "Contains",
value: values[i]
},
{
operator: "Contains",
value: values[i + 1]
}
);
filters.push(filter)
}
this.host.applyJsonFilter(filters, "general", "filter", FilterAction.merge);
}
}
}
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |