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

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

Reply
jeffiefgf
Frequent Visitor

DataView tree documentation

I am creating a custom tree visual that's similar to a decomposition tree but I'm not sure which dataViewMapping is best for creating trees. When I was trying things out with Categorical data mapping, I found out that there is a tree data mapping which is not in Microsoft's documentation (https://docs.microsoft.com/en-us/power-bi/developer/visuals/dataview-mappings😞 

jeffiefgf_0-1648667456199.png

 

I tried looking further for its documentations but I'm not able to find anything. If anyone can show me how tree data mapping works or has any suggestions about which data mapping works best with trees, it would be greatly appreciated. Thanks in advance.

3 REPLIES 3
dm-p
Super User
Super User

Hi @jeffiefgf,

Not sure why that's there (IIRC it has been for as long as I've been developing), but the following valid data view mappings in the API are as documented:

  • single
  • categorical
  • table
  • matrix
  • scriptResult (for R visuals)

This can be confirmed by checking the schema defs for the API.

Your best bet might be to use matrix, as this supports selections for each level of a hierarchy and has had a lot more investment in the last few API releases (particularly with fetching/lazy-loading more data from the model programmatically, although I haven't personally used it recently).

Categorical has very simple support for hierarchies (either drill or expand, and you only have info about the currently displayed level), whereas matrix uses a recursive mapping that should allow you to traverse the whole dataset without user interaction.

A good place to start might be to look at the source for Hierarchy Slicer (by Jan Pieter Posthuma), which uses this mapping and has options to filter out null levels in a dataset without modelling.

Hopefully some of this can help you get started. 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)




Thank you @dm-p for your reply, matrix does look like the right place to start but if I use matrix to map data, is it possible to get the values at each level, not just the leaf nodes?

 

What I mean by that is if you look at the data structure of a matrix:

jeffiefgf_0-1648746897238.png

we only get the "values" for the leaf node Grand child1 but not Parent1 and Child1. For the tree structure I am creating, I'll need the values for all nodes, so that it can look like something similar to this:

jeffiefgf_1-1648747234837.png

Again, thank you in advance, I am still new to this so I really appreciate your help!

Hi @jeffiefgf - I've never worked with more than 2 levels, but if this is how it is implemented for more than that, then you may need to 'collect' the node values on the way through and add them to your viewmodel before they are 'lost', rather than re-processing the data portion of your viewmodel entirely for each update?

Failing that, someone else with more experience with the matrix mapping may be able to weigh-in.





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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.