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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Custom Visual - How to get selected items from a dimension?

We have a simple custom visual which has some dimensions as a categorical type.


With options.dataViews[0] etc. we get all of the possible values. But what we need is the user selected values instead all of them. Like when you're having country and products - if the users selects only a country we should get no value for products as no element is selected (no matter if values are possible!). Any example for this?

 

Got a look at the selectionManager but had to give up due to...lacking documentation(?). Using the latest API version / pbiviz.

 

3 REPLIES 3
dm-p
Super User
Super User

Hi @Anonymous,

It's not entirely clear from your description what the actual problem is. The dataView contains the currently selected items in the report, for example from a slicer or other visual. If your visual's dataView contains all data then it implies there are no particular filters currently applied to it. Depending on your use case, it might be how your dataRoles are configured, or you might have to apply filtering or highlighting to do what you want with the data passed into the dataView.

If you are able to provide some code or a more detailed description of your expected outcomes then I might be able to provide more targeted help. Failing that, you can try posting in the Custom Visuals Development Discussion forum and the dev team can help (they only monitor that forum for questions).

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)




Anonymous
Not applicable

Hi @dm-p ,

 

Let me try to explain it by an example:

 

ProductCountry
ProdAItaly
ProdBGermany
ProdCGermany

 

I'm passing both dimensions to my custom visual. I need to distinguish between "has data/connection" and "isUserSelected". For example, user selects Italy - custom visual is getting ProdA. BUT: This is not user selected, it just has a connection to Italy. I need only Italy. IF the user now selects also ProdA & Italy, I should get ProdA and Italy as both are selected. It's fine to get all possible elements, but I need to check somehow if the element is really user selected or just with data.

 

Hope this helps a bit? 

 

(and sorry for the wrong section in the forum, didnt saw it yesterday 😞 Maybe some mod could move it to the custom visual dev. place 🙂 )

Hi @Anonymous,

Thanks for clarifying - I'm still not 100% sure, but it sounds like you're after the ability to have partial highlighting support on your visual (where all data is passed, but the selected values are also indicated)? If so, you need to add supportsHighlight: true to your capabilities.json.

The previous link references a follow-up article on coding the support for highlights, which documents what you'll see in your dataView after enabling the capability. You will need to compare the entries from the highlights array with those in the values array to determine which data points are affected and write code accordingly to dim/hide (or however you want to represent visually) the visual representation of these data points.

I hope that this gets you moving in the right direction. Good luck!

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)




Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.