Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
JohnTheDoe
Frequent Visitor

Custom filters in custom visuals

I currently have a table where the data in one of the columns are of type string, like "100% 22 hours". 

 

Let's say I want to create a custom visual that counts the amount of rows where the data in that column is greater than 100%. However, because the data is a string, to filter those rows I can't exactly use "GreaterThan" with the AdvancedFiltering API, like this:

 

let conditions: IAdvancedFilterCondition[] = [];

conditions.push({ operator: "GreaterThan", value: "100%" });

Let's also that I am not allowed to clean the dataset before inputting it into PowerBI. Is there a way for me to create a custom function that is responsible for the logic deciding which data gets filtered and pass it into the AdvancedFilter API, like below?

 

let conditions: IAdvancedFilterCondition[] = [];

conditions.push((data) : boolean => {
//Do some parsing logic to extract the percent number

//Do some logic to determine if extracted number is greater than 100

//return true or false
});

 

If not, how else could I achieve this filtering logic in this scenario?

 

Thanks.

1 REPLY 1
v-viig
Community Champion
Community Champion

It seems you can try to use Contains condition operator instead of LessThan to filter text values.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.