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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
KennethWang
Frequent Visitor

SelectionIdBuilder - For consolidated data categories

Hi, I have a very specific use case for PowerBI Custom Visuals.  I managed to convert and reference many of the existing examples to what I need, but I am having a problem understanding how selection works, or works in my use case.

 

Say, for example, if I have a dataset (inventory log)

USER IDITEMS
0001Book
0001Ruler
0002Eraser
0001Bag
0002Book
0003Book
0003Eraser

 

In my visual bar chart (d3), I want to show

 

Inventory Group 1 (Book+Ruler+Bag) => Count = 1

Inventory Group 2 (Book+Eraser) => Count = 2 

 

So as it is, I'll have to pre-process the data into an array (I used associative array), which is fine.

 

The problem I have is on selection. I'll like to be able to click on "Inventory Group 1" and have it selected/filtered across other visuals (showing User 0001, and Book, Ruler, Bag) and "Inventory Group 2" to show (User 0002 and User 0003, and Book, Eraser) in other visuals.

 

I used something like

 

identity: host.createSelectionIdBuilder()
                    .withCategory(categorical.User, 1)
                    .withMeasure(_CustomArrayUsers[0])

Which is filtering only the first record. When I clicked "Inventory Group 1", it shows User 0001 BUT only "Book" row got highlighted (in the other visual). When I clicked "Inventory Group 2", it shows (only) User 0002 and only "Eraser",

 

Is this type of selection supported in PowerBi? Thanks.

 

Regards,

 

Kenneth

 

 

 

 

3 REPLIES 3
dm-p
Super User
Super User

Hi @KennethWang,

It's possible the .withMeasure() is the culprit but it's quite hard to verify without knowing the structure of the _CustomArrayUsers[0] entry you're feeding into it. This should be a string representation of the measure name from your field's metadata. It would also be worth taking a look at the category processing too, to make sure that it's passing in the correct values. If you're able to share your code then that would be a great help in helping you out. If you want to share privately, feel free to PM me and I'll try to free up some time to have a look for you.

Also: consider checking the version of powerbi-visuals-tools you're using - we found out there is definitely something funky with Selection IDs in 2.1.0 the other day and this may be compounding the problem.

Regards,

Daniel





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

Proud to be a Super User!


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




@dm-p Thank you! I was using 2.6.1. 

 

I think I figured out what I need using BasicFilter. It worked for me but I am confused between SelectionManager vs Basic/Advanced Filters.

 

Also, api 2.6.1 required a few tweaks from examples to make things work. 

Yes, if you're on 2.6 + of the API / 3.x of the SDK then the doc is woefully out of date, but sounds like you're rocking, which is the important thing here! Glad you're sorted 🙂





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

Proud to be a Super User!


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




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.