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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

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
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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