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
paul-maessen
Resolver I
Resolver I

Merge multiple selectionId's into the identity of a data point

Hi,

 

I have a question regarding the creation of selectionId's for a data-point.

 

In my custom visual I am using a Table DataView.  However in the rendered visual I am combining multiple rows of the table into a single data-point. However when filtering on this data-point I would like to filter on all the rows in my Table DataView.

When creating a selectionId using the IVisualHost.createSelectionIdBuilder I can use the .withTable-method to create a selection Id from a single row in the dataView by adding the index from this row.  (Add interactivity into visual by Power BI visuals selections

 

Is there a posibility to add multiple rows to a single selectionId?

 

Thanks in advance.

 

Paul 

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi @paul-maessen,

Chaining IDs in this way typically confuses the main window when you pass selections through to it, as this doesn't reconcile to the row context that it thinks it gave your visual and doesn't really know how to apply them to other visuals.

Not to say it isn't possible - I have tried it in the past to attempt to work around limitations with mappings - but I abandoned my attempts quite quickly. There may be a way to do this, but I doubt it's supported if you can.

For cross-filtering, you can consolidate individual data point IDs into an array that you can pass to the selection manager - this is effectively the same scenario as managing Ctrl + Click for multi-select but you're doing it artificially.

So, I think that if you're looking to filter multiple rows with a table mapping, the best bet might be to (possibly dynamically) create an array of elegible selection IDs you want to apply for a particular event and pass that to the selection manager when your event occurs.

Based on your above use case, I would probably create a property for my 'row' that permits an array of underlying selection IDs and store each individual ID this row represents in this array. This can then be passed to the selection manager when the selection event occurs.

You will likely need to ensure that you're not passing a very high amount of selectors, as this can cause performance impacts on the main window as it tries to keep all visuals in sync. I personally cap this at around 250 in any visuals that may have a high row count and display an alert to the user if they go over the limit, but you'll maybe need to profile this as part of your explorations to dtermine what works for you.

The only other ways to 'consolidate' IDs are to use different mappings - for categorical, you have the option to use .withSeries() and you can sometimes use .withMeasure() on its own as long as you're sure that this suits your case.

Regards,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

3 REPLIES 3
dm-p
Super User
Super User

Hi @paul-maessen,

Chaining IDs in this way typically confuses the main window when you pass selections through to it, as this doesn't reconcile to the row context that it thinks it gave your visual and doesn't really know how to apply them to other visuals.

Not to say it isn't possible - I have tried it in the past to attempt to work around limitations with mappings - but I abandoned my attempts quite quickly. There may be a way to do this, but I doubt it's supported if you can.

For cross-filtering, you can consolidate individual data point IDs into an array that you can pass to the selection manager - this is effectively the same scenario as managing Ctrl + Click for multi-select but you're doing it artificially.

So, I think that if you're looking to filter multiple rows with a table mapping, the best bet might be to (possibly dynamically) create an array of elegible selection IDs you want to apply for a particular event and pass that to the selection manager when your event occurs.

Based on your above use case, I would probably create a property for my 'row' that permits an array of underlying selection IDs and store each individual ID this row represents in this array. This can then be passed to the selection manager when the selection event occurs.

You will likely need to ensure that you're not passing a very high amount of selectors, as this can cause performance impacts on the main window as it tries to keep all visuals in sync. I personally cap this at around 250 in any visuals that may have a high row count and display an alert to the user if they go over the limit, but you'll maybe need to profile this as part of your explorations to dtermine what works for you.

The only other ways to 'consolidate' IDs are to use different mappings - for categorical, you have the option to use .withSeries() and you can sometimes use .withMeasure() on its own as long as you're sure that this suits your case.

Regards,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




@dm-p 

 

Thanks Daniel for the answer. Unfortunately I have the same experiences as you described.

I do have a question about an other solution I might want to try:

 

On each rendered data-point I have added an array with all the rows of the data-table as a BaseDataPoint that is combined into this data-point, each row has it's unique selectionId/identity.

 

In the InteractionServices Behavior I normally call the handleSelection()-method from the selectionHandler (

ISelectionHandler) when a data-point has been clicked. Normally I only would pass the data-point that has been clicked to this method and the check if I want to multi-select or not (Ctrl-Click).  
The question now is:  Can I pass the data-points that are in the array to this handleSelection()-method?
This method does support an array of data-points as parameter.
 
Regards
 
Paul

 

Hi @paul-maessen

It might be that you're using powerbi-visuals-utils-interactivityutils? I haven't used this recently enough to be familiar with it off the top of my head and this might wrap the host selection manager for the most comon use cases. As such this could be a limitation of this API and may need a change request to facilitate.

My suggestion probably stems from the fact that I typically work directly against the visual host's .createSelectionManager() and its subsequent .select() method to pass in my IDs. This method accepts either an array or an individual ID and will 'stack' selectors if the multiSelect parameter is true.

Not sure if this helps with your idea but might provide some further insight.

Regards,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




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.