powerbivisualizationvega-litevegadeneb

Data inputs for Sankey Chart in Vega on PowerBI Deneb


I am trying to create a similar visual as in this link below in Deneb PowerBI:Sankey charts (allvuial charts) - By PBI - Davide. I see that the data is entered manually inside in the form of JSON such as:

"data": [
    {
      "name": "input",
      "values": [
        {
          "category": "Server Products & Cloud",
          "stack": 1,
          "sort": 1,
          "labels": "left"
        },
        {
          "category": "Enterprise Services",
          "stack": 1,
          "sort": 2,
          "labels": "left",
          "gap": 20
        },
        {
          "category": "Office Products",
          "stack": 1,
          "sort": 3,
          "labels": "left"
        }
}

In PowerBI, the data is imported in the form of

{
  "data": [
    {
      "name": "dataset"
    } 
}

Is there a way to somehow use the values from "dataset" of PowerBI fields (taking advantage of the filter context to derive specific values) in the "name":"input" fields.

For example : I want to achieve something like this

"data": [
{
  "name": "dataset"
},
{
  "name": "input",
  "values": [
    {
      "category": "Server Products & Cloud",
      "stack": "datum['Measure1']",  //Custom value from PowerBI measures
      "sort": 1,
      "labels": "left"
    },
    {
      "category": "Enterprise Services",
      "stack": "datum['Measure2']",  //Custom value from PowerBI measures
      "sort": 2,
      "labels": "left",
      "gap": 20
    },
    {
      "category": "Office Products",
      "stack":"datum['Measure3']",  //Custom value from PowerBI measures
      "sort": 3,
      "labels": "left"
    }
}

However, its not allowing me to do so. I an very new to Vega and I think there is a different way to reference these values.


Solution

  • There are two reports in the .pbix. Inline has inline data like you say but the second report named Data Driven already does what you ask.