Decomposition tree sample visual fitting

51 Views Asked by At

Here is a sample provided by Davide Bacci:

Text

I would like to use this template for my .pbix file; however, it's not working as expected. In Davide's example, the datasource is a JSON, whereas I have a Power BI dataset. I need to replicate a similar structure, especially the first line (Max Armstrong), to make it work.

Here is a sample of my data structure: https://github.com/tomecsek21/pbix_file

The visual should begin with a node representing total revenues, and then it should be divided into sublevels. Nodes should always be sorted based on revenues, from highest to lowest.

1

There are 1 best solutions below

1
davidebacci On BEST ANSWER

You have multiple roots and a tree works from a single root. To keep this simple, rename your columns as follows:

enter image description here

Add them to a Deneb visual but put a filter on so you only see a single root:

enter image description here

In the spec, overwrite source with the following:

 {
  "name": "dataset"
},
{
  "name": "source",
   "source": "dataset"
},

Change the domain to the following (my kpis were percentages hence the hard coded 0-100):

{
      "name": "kpiscale",
      "zero": false,
      "domain": [0, 1800],
      "range": {"signal": "[0,scaledNodeWidth]"}
    },

enter image description here

That should be enough for you to restructure your data but if you add more levels, you will need to update the Vega.