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
jprmsn
Frequent Visitor

SelectionIdBuilder withmatrixnode hiearchy

I'm struggling with setting the correct selection Ids to use with row selection, drill-though, and report page tooltips with my custom matrix visual.

 

Right now, I am creating IDs using .withMatrixNode and then passing an array of them to these functions.  Here's an example for a matrix row with two categories set:

0: e

dataMap: dim HealthSystem.Health System: [{…}]

key: "{"dim HealthSystem.Health System":[{"identityIndex":24}]}[]"

measures: []

 

1: e

dataMap: dim Facility.Facility: [{...}]

key: "{"dim Facility.Facility":[{"identityIndex":25}]}[]"

measures: []

 

When I call (for example selectionmanager.select) more than one selection ID (e.g. two categories), I get a message on my crossfiltered visuals that says: “We can’t display this visual because a measure is used in cross highlighting.  Please remove the measure or cross highlight”. None of my selection IDs include measures.

 

I need to be able to select multiple categories to  correctly filter my other visuals and also to be able to set the context for report page tooltips.  The stock matrix is able to do this, but I don't know what the selectionIds look like.

 

I couldn't find any matrix samples that handle a hierarchy.  Can anyone give me a steer?

Thanks.

John

1 ACCEPTED SOLUTION
jprmsn
Frequent Visitor

The key here is to stack calls to the builder and not call createSelectionId until done.  So, for example, you can call .withMatrixNode for a row node, another row node, then a column node, then call create and you will end up with a Selection ID for the "intersection" of the two rows and the column.

View solution in original post

2 REPLIES 2
jprmsn
Frequent Visitor

I see from debugging a stock matrix that their should be a single selection ID that looks like this:

"{"comp":{"k":0,"l":{"col":{"s":{"e":"Table1"},"r":"Field"}},"r":{"const":{"t":1,"v":"Table2"}}}}"

 

That look familiar to anyone?  Trying to figure out how to construct it.

Thanks.

John

jprmsn
Frequent Visitor

The key here is to stack calls to the builder and not call createSelectionId until done.  So, for example, you can call .withMatrixNode for a row node, another row node, then a column node, then call create and you will end up with a Selection ID for the "intersection" of the two rows and the column.

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.