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
jasemilly
Helper II
Helper II

Basic Deneb Table change order of columns

Hi I have been following this tutorial and have it working on my own data, I would like to change the order of the columns but can't seem to figure it out or find any examples.

https://www.youtube.com/watch?v=2wZpdZ8hCik&t=466s 

Say I have

ColA     ColB   ColC

and I would like 

ColB  ColC   ColA

thanks for all ideas.

1 ACCEPTED SOLUTION
giammariam
Solution Sage
Solution Sage

If you don't want to bring in an additional sort order field into deneb, you could implement a transform to do the sorting and then use it in the x encoding: 

giammariam_0-1675954861121.png

If this is enough to get you going, please consider kudoing and choosing this reply as the solution. If you need additional help, let me know.

Full spec: 

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "width": {
    "step": 30
  },
  "data": {
    "url": "https://raw.githubusercontent.com/vega/vega-datasets/next/data/penguins.json"
  },
  "transform": [
    {"window": [{"op": "row_number", "as": "row_num"}]},
    {"filter": {"field": "row_num", "lte": "count"}},
    {"fold": ["Flipper Length (mm)", "Species", "Island", "Sex"]},
    {
      "calculate": "datum['key'] == 'Species' ? 1 : datum['key'] == 'Sex' ? 2 : datum['key'] == 'Island' ? 3 : datum['key'] == 'Flipper Length (mm)' ? 4 : null", "as": "key_sort"
    }
  ],
  "mark": "text",
  "encoding": {
    "y": {"field": "row_num", "type": "ordinal", "axis": null},
    "text": {"field": "value", "type": "nominal"},
    "x": {"field": "key", "sort": {"field": "key_sort"},"type": "nominal", "axis": {"orient": "top", "labelAngle": 0, "title": null, "domain": false, "ticks": false}, "scale": {"padding": 15}}
  }, "config": {"view": {"stroke": null}}
}

 



Madison Giammaria
Proud to be a Super User 😄
LinkedIn

Do you frequently use Deneb to provide insights to your stakeholders? Have you considered sponsoring this free and open source custom visual? More info here!

View solution in original post

2 REPLIES 2
giammariam
Solution Sage
Solution Sage

If you don't want to bring in an additional sort order field into deneb, you could implement a transform to do the sorting and then use it in the x encoding: 

giammariam_0-1675954861121.png

If this is enough to get you going, please consider kudoing and choosing this reply as the solution. If you need additional help, let me know.

Full spec: 

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "width": {
    "step": 30
  },
  "data": {
    "url": "https://raw.githubusercontent.com/vega/vega-datasets/next/data/penguins.json"
  },
  "transform": [
    {"window": [{"op": "row_number", "as": "row_num"}]},
    {"filter": {"field": "row_num", "lte": "count"}},
    {"fold": ["Flipper Length (mm)", "Species", "Island", "Sex"]},
    {
      "calculate": "datum['key'] == 'Species' ? 1 : datum['key'] == 'Sex' ? 2 : datum['key'] == 'Island' ? 3 : datum['key'] == 'Flipper Length (mm)' ? 4 : null", "as": "key_sort"
    }
  ],
  "mark": "text",
  "encoding": {
    "y": {"field": "row_num", "type": "ordinal", "axis": null},
    "text": {"field": "value", "type": "nominal"},
    "x": {"field": "key", "sort": {"field": "key_sort"},"type": "nominal", "axis": {"orient": "top", "labelAngle": 0, "title": null, "domain": false, "ticks": false}, "scale": {"padding": 15}}
  }, "config": {"view": {"stroke": null}}
}

 



Madison Giammaria
Proud to be a Super User 😄
LinkedIn

Do you frequently use Deneb to provide insights to your stakeholders? Have you considered sponsoring this free and open source custom visual? More info here!

@giammariam thank you again worked!!!

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.

Top Solution Authors
Top Kudoed Authors