Forum Discussion
Null or Empty Selection?
I have a map-based visual that supports spatial filtering. Currently, if I draw a spatial filter, the points within the filter are added to the current selection, and other visuals are properly cross-filtered.
The problem is if my spatial filter returns no points. If I clear the selection set, all values are displayed in the other visuals. Is there a way I can manipulate the current selection so that no records are displayed in the other visuals? Maybe a "null" selection id that references no existing record?
I don't think so since it isn't the common workflow for Power BI.
If not items are selected that means all of items must be shown in other visuals.
Our recommendation is to follow the common workflow in order not to confuse users.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
5 Replies
- v-viigCommunity Champion
How do you generate SelectiId?
You might create empty SelectionId and try to use it.
Please note common practice is to show all of values if no values are selected.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
- psyangFrequent Visitor
I wasn't sure how to construct a null selectionId. I just created a new instance of SelectionId with no parameters. Adding this to the selection did the same as clearing all selection - it showed all values.
Is there a way to create a fake selection Id? One where the criteria in the key returns no result - like "column=-1" where it is guaranteed that column > 0?
I don't fully understand selection id's and identities as documentation on these objects is pretty slim. They all seem to be generated for us, so creating a fake one is foreign territory.
One other thing - I am using a table dataview instead of categorical. Not sure if that makes a difference. I used your suggestion in another thread to generate the table dataview selection Ids.
- v-viigCommunity Champion
You might try to generate a selection by callig ISelectionIdBuilder.withMeasure("Some_faked_value").createSelectionId();
Please let us know if that works as you expected.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals