cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
psyang Frequent Visitor
Frequent Visitor

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator v-viig
Moderator

Re: Null or Empty Selection?

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

pbicvsupport@microsoft.com

5 REPLIES 5
Moderator v-viig
Moderator

Re: Null or Empty Selection?

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

pbicvsupport@microsoft.com

psyang Frequent Visitor
Frequent Visitor

Re: Null or Empty Selection?

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. 

Moderator v-viig
Moderator

Re: Null or Empty Selection?

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

pbicvsupport@microsoft.com

psyang Frequent Visitor
Frequent Visitor

Re: Null or Empty Selection?

Thanks for the suggestion, but unfortunately it didn't work. I created a fake selection id by setting a fake value in the withMeasure() method, but adding that selection id to the selection set still caused all records to display.

 

I wonder if, because I am using a table dataview, there are no measures, and so the fake selection id is ignored. Am I able to create a selection id that goes against an existing column of the table, but with a fake value specified?

Moderator v-viig
Moderator

Re: Null or Empty Selection?

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

pbicvsupport@microsoft.com