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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
naelske_cronos
Helper III
Helper III

Deneb - Vega Lite - Group a matrix on 2 levels

Hello,

 

In Deneb / Vega-Lite, I would like to group a matrix based on the column 'Customer' and 'Product' but I only get it working for one group but I want both on row level and not column level.

 

This is my code:

{
"data": {
    "values": [
      {"Customer": "Kevin N.V.", "Product": "PH114", "YearMonthText": "2024.01", "Column": "Forecast", "_Value": 24},
      {"Customer": "Kevin N.V.", "Product": "PH114", "YearMonthText": "2024.01", "Column": "Percentage", "_Value": 0.90},
      {"Customer": "Kevin N.V.", "Product": "PH114", "YearMonthText": "2024.02", "Column": "Forecast", "_Value": 74},
      {"Customer": "Kevin N.V.", "Product": "PH114", "YearMonthText": "2024.02", "Column": "Percentage", "_Value": 0.75},
      {"Customer": "Kevin N.V.", "Product": "PH878", "YearMonthText": "2024.01", "Column": "Forecast", "_Value": 744},
      {"Customer": "Kevin N.V.", "Product": "PH878", "YearMonthText": "2024.01", "Column": "Percentage", "_Value": 0.05},
      {"Customer": "Kevin N.V.", "Product": "PH878", "YearMonthText": "2024.02", "Column": "Forecast", "_Value": 4},
      {"Customer": "Kevin N.V.", "Product": "PH878", "YearMonthText": "2024.02", "Column": "Percentage", "_Value": 0.07},
      {"Customer": "Klaas N.V.", "Product": "PH200", "YearMonthText": "2024.01", "Column": "Forecast", "_Value": 77},
      {"Customer": "Klaas N.V.", "Product": "PH200", "YearMonthText": "2024.01", "Column": "Percentage", "_Value": 0.65},
      {"Customer": "Klaas N.V.", "Product": "PH200", "YearMonthText": "2024.02", "Column": "Forecast", "_Value": 80},
      {"Customer": "Klaas N.V.", "Product": "PH200", "YearMonthText": "2024.02", "Column": "Percentage", "_Value": 0.8},
      {"Customer": "Klaas N.V.", "Product": "PH527", "YearMonthText": "2024.01", "Column": "Forecast", "_Value": 4},
      {"Customer": "Klaas N.V.", "Product": "PH527", "YearMonthText": "2024.01", "Column": "Percentage", "_Value": 0.77},
      {"Customer": "Klaas N.V.", "Product": "PH527", "YearMonthText": "2024.02", "Column": "Forecast", "_Value": 88},
      {"Customer": "Klaas N.V.", "Product": "PH527", "YearMonthText": "2024.02", "Column": "Percentage", "_Value": 0.9}
    ]
  },
  "facet": {
    "row": {
      "field": "Product",
      "title": null,
      "header": {"labelFontSize": 14}
    }
  },
  "spec": {
    "encoding": {
      "y": {
        "field": "Column",
        "title": null
      },
      "x": {
        "field": "YearMonthText",
        "title": null,
        "axis": {"orient": "top"}
      }
    },
    "layer": [
      {"mark": {"type": "rect"}},
      {
        "mark": {
          "type": "text",
          "fontSize": 12
        },
        "encoding": {
          "text": {
            "field": "_Value",
            "type": "quantitative"
          }
        }
      }
    ]
  }
}

 

Kind regards

1 REPLY 1
lbendlin
Super User
Super User

something like this? Faceting a Plot into a Trellis Plot | Vega-Lite

 

Why Deneb and not a regular chart like a multi card or a matrix? 

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.