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.
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 ID | ITEMS |
0001 | Book |
0001 | Ruler |
0002 | Eraser |
0001 | Bag |
0002 | Book |
0003 | Book |
0003 | Eraser |
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
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
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 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 🙂
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)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
2 | |
2 | |
1 | |
1 |