Quantcast
Channel: Developer topics
Viewing all articles
Browse latest Browse all 18114

Custom filters in custom visuals

$
0
0

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.


Viewing all articles
Browse latest Browse all 18114

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>