How to insert our dataset values in the Deneb Sankey Chart in PowerBi
I am using Deneb Sankey Chart in PowerBI https://github.com/PBI-David/Deneb-Showcase/tree/main/Sankey%20Chart due to the lack of personalization of the powerBi sankey chart. I am not familiar with Vega so I tried to use David code without really changing it too much.
I wanted to make a sankey like:
- first stack : total amount
- second stack : sankey_type (containing 2 categories => Product/Service)
- third stack : category2 (containing 5 categories => Visible/under the radar/No BOM/No Opportunity ID/Highway Robbery)
- The thickness would be the amount in euros.
The idea of this sankey is to show where the money goes following our stacks.
I am using 3 columns :
- sankey_type
- categoriy2
- Amount in EUR
"data": [
{
"name": "input",
"values": [
{
"category": "Total amount",
"stack": 1,
"sort": 1,
"labels": "left"
},
{
"category": "Product",
"stack": 2,
"sort": 1
},
{
"category": "Service",
"stack": 2,
"sort": 2
},
{
"category": "Visible",
"stack": 3,
"sort": 1
},
{
"category": "under the radar",
"stack": 3,
"sort": 2
},
{
"category": "No BOM",
"stack": 3,
"sort": 3
},
{
"category": "No Opportunity ID",
"stack": 3,
"sort": 4
},
{
"category": "Highway Robbery",
"stack": 3,
"sort": 5
},
{
"source": "Total amount",
"destination": "Product",
"value": 20
},
{
"source": "Total amount",
"destination": "Service",
"value": 1.9
},
{
"source": "Product",
"destination": "Visible",
"value": 11.8
},
{
"source": "Product",
"destination": "under the radar",
"value": 11.8
},
{
"source": "Product",
"destination": "No BOM",
"value": 11.8
},
{
"source": "Product",
"destination": "No Opportunity ID",
"value": 11.8
},
{
"source": "Product",
"destination": "Highway Robbery",
"value": 11.8
}
]
},
I truncated the top and bottom of the code because the solution is (probably) hiding in this part. You can find the rest of it in David github.
You might notice that the "value" are hardcoded (e.g : number as 11.8). I tried many things as writing my column in the category section or my Amount in EUR in the value section but it didn't work.
My question is How to "link" my columns and values in this code to obtain the sankey I mentionned earlier.
Sorry for my unperfect english and thanks for your time reading this.
Edit : For example I also tried stuff like
{
"source": "Product",
"destination": "Visible",
"value": {
"data": "dataset",
"field": "amount visible"
}
},
where amount visible is the amount of product visible to replace the static value by my PowerBI measures but it didn't work. It gives me "Cannot set properties of undefined (setting 'index')".