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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
CameronRae
New Member

Using the Vega-Lite Impute Statement within Deneb

Hi Everyone,

 

I’ve recently started learning how to work with Vega-Lite.  

 

I’m looking to produce a form of academic calendar visualisation through Power BI/Deneb (with rows per term and columns per week). As the data is quite sparse, I opted to use Vega-Lite transform statements such as ‘impute’ to fill in gaps in the data.

 

Although the specification works as expected within the Vega-Lite online editor environment (see simplified code sample below), the equivalent specification doesn’t fully work within Deneb. There don’t appear to be any errors or warnings, but the ‘impute’ statements don’t seem to have any effect.

 

Is it possible to use the ‘impute’ statement to add records to a Deneb ‘dataset’? If not, is there an alternative/better way to achieve the desired outcome?

 

Thanks in advance

 

Simplified Vega-Lite specification…

 

{

  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",

  "data": {

  "values": [

       {"Term": "Term 1", "Week No": "Wk. 1", "Description": "Lesson 1",  "Attendance": 1, "Attendance Text": "Attended"},

       {"Term": "Term 1", "Week No": "Wk. 5", "Description": "Lesson 2",  "Attendance": 3, "Attendance Text": "Unauthorised Absence"},

       {"Term": "Term 2", "Week No": "Wk. 2", "Description": "Lesson 3",  "Attendance": 1, "Attendance Text": "Attended"},

       {"Term": "Term 2", "Week No": "Wk. 6", "Description": "Lesson 4",  "Attendance": 2, "Attendance Text": "Authorised Absence"},

       {"Term": "Term 3", "Week No": "Wk. 7", "Description": "Lesson 6",  "Attendance": 0, "Attendance Text": "Future Event"}

      ]

    },

    "transform": [

      {

       "impute": "Attendance Text",

       "key": "Term",

       "keyvals": ["Term 1", "Term 2", "Term 3"],

       "value": "No Event"

     },  

     {

      "impute": "Attendance Text",

      "key": "Week No",

      "keyvals": ["Wk. 1", "Wk. 2", "Wk. 3", "Wk. 4", "Wk. 5", "Wk. 6", "Wk. 7", "Wk. 8"],

      "value": "No Event",

      "groupby": ["Term"]

    }

    ],

    "mark": "rect",

    "encoding": {

      "x": {"field": "Week No"},

      "y": {"field": "Term"},

      "color": {"field": "Attendance Text"}

    }

}

 

Sample output…

 

CameronRae_0-1697802601023.png

 

3 REPLIES 3
lbendlin
Super User
Super User

@dm-p would you be able to advise if impute is supported?

@lbendlin - Deneb uses the Vega-Lite parser, so it's supported. It seems to work as I would expect if I take the sample spec and create a visual with it:

 

dmp_0-1698096124328.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Thanks for confirming Daniel. I'll investigate further.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors