Forum Discussion
Support other visuals' selection in custom slicer
- 7 years ago
Hi,
To merge filtration, you should use applyJsonFilter with "merge" option.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
[email protected]
"I see IFilterKeyHierarchyTarget but how to fill it and how to set conditions for all levels of hierarchy? This topic tells that only one filter can be applied."
Regarding this question, I don't have any examples of using this filter, but I can say that you can pass an array of filters into applyJsonFilter function that will be mean logical AND.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
[email protected]
I replace selection in custom matrix visual with filtering through applyJsonFilter. Now Power BI does not hang and I can cancel filtering by another click. But all the visuals keep refreshing repeatedly.
I can guess the following. One custom visual applies filter. So all other visuals should be refreshed. When refreshing another custom visual applies its filter. All other visuals (including first one) should be refreshed again. First custom visual applies its filter again. And this process continues.
Am I right that there is no control on filters duplication?
If my giess is correct can custom visual recognize that its filter is applied now?
If I'm wrong what is the problem?
- v-evelk7 years agoMicrosoft Employee
I can say that it depends on a visual and how it is implemented. Since you use filtration, your update options must contain something like options.jsonFilters so, you can detect whether there are any already applied filters or not.
Also, since you switched Selection model to Filtration model I can recommend you to remove visuals from your report and add them again because there is a chance that some old filtration or selection was saved and now it breaks filtration.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
[email protected] - Anonymous7 years agoNot applicable
(I rebuilt report.)
I observe several problems with field options.jsonFilters in update method.
A) First of all I apply filters like following.{ "$schema": "http://powerbi.com/product/schema#advanced", "target": { "table": "Data", "column": "Type" }, "filterType": 0, "logicalOperator": "And", "conditions": [ { "operator": "Is", "value": "Type2" } ] }But on next iteration options.jsonFilters contains another type of filter.
{ "$schema": "http://powerbi.com/product/schema#basic", "target": { "table": "Data", "column": "Type" }, "filterType": 1, "operator": "In", "values": [ "Type2" ] }Is it normal behavior?
B) Does field options.jsonFilters contain filters applied by this visual only?
C) Are there any methods to compare filters in view of issue A?
D) In custom matrix visual field options.jsonFilters contains applied filters. But in custom slicer visual it is always empty. Why so? - v-evelk7 years agoMicrosoft Employee
A) It is a regular situation that filter looks not exactly the same as initial when you get it from options.jsonFilters .
It happens because filter will be converted into a query inside Power BI and then will be restored form this query when you receive it.
B) options.jsonFilters should contain all applied filters as I know.
C) I am not sure
D) It may happens if your custom visual uses an old API because jsonFilters appeared only in API 2.2 but it is better to use the latest API.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
[email protected] - Anonymous7 years agoNot applicable
pbiviz.json of both projects contains
"apiVersion": "2.3.0"
May filters visibility depend on either type of filtered column or kind in dataRoles (capabilities.json)? It is Text in Grouping for custom matrix visual and Date in GroupingOrMeasure for custom slicer visual.
- v-evelk7 years agoMicrosoft Employee
No, I don't think so.
You can send the source code and the report to [email protected] and I will try to figure out what is wrong with filtration if you wish.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
[email protected]