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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
psyang
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
v-viig
Community Champion
Community Champion

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

View solution in original post

5 REPLIES 5
v-viig
Community Champion
Community 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

pbicvsupport@microsoft.com

psyang
Frequent 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-viig
Community Champion
Community 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

pbicvsupport@microsoft.com

psyang
Frequent Visitor

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?

v-viig
Community Champion
Community Champion

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.