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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
jabrillo
Helper I
Helper I

Deneb Data Bar

How do you create a data bar using Deneb? It will show a measure that is a percentage value as a bar and the color of the bar depending on the value. For example, green if value is 1 and below and red if value is greater than 1. Since it is also a measure, I have to hard-code the field name on the left side and the value itself in percentage format on the right side. Please advise. I'm still learning Deneb.

1 REPLY 1
giammariam
Solution Sage
Solution Sage

Hey @jabrillo. I have a basic implementation of what you described. Take a look and let me know if anything needs to be tweaked. Also, if you need help getting it working in deneb, let me know. If this gives you enough to move forward, please consider marking it as a solution.

giammariam_0-1674578106102.png

giammariam_1-1674578159828.png

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "width": 400,
  "height": 50,
  "view": {
    "fill": "gainsboro"
  },
  "data": {"name": "dataset", "values": [{"value": 1.15, "label": "My Value"}]},
  "encoding": {
      "x": {"scale": {"domain": [0,1.0]}, "axis": {"format": ".0%", "tickCount": 1}, "title": null},
      "y": {"field": "label", "type": "nominal", "scale": {"paddingInner": 0.2}, "title": null}
  },
  "layer": [
    {
      "mark": {"type": "rect"},
      "encoding": {
        "color": {"value": "gainsboro"}
       }
    },
    {
      "mark": {"type": "rect"},
      "encoding": {
        "x": {"field": "value", "type": "quantitative"},
        "color": {"condition": {
          "test": "datum['value']<=1",
          "value": "green"
        }, "value": "red"}
      }
    },
    {
      "mark": {"type": "text", "align": "left"},
      "encoding": {
        "text": {
          "field": "value",
          "format": ".0%"
        },
        "x": {
          "field": "value", "type": "quantitative"
        },
        "xOffset": {
          "value": 5
        }
      }
    }
  ]
}

 



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!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors
Top Kudoed Authors