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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

New Member

Vega-lite Deneb Y axis setting min value

using Veg-Lite I am trying to set the min value on then Y axis to be dynamic based on a data field "MLL 8%", in my case I have a $100K trading account and I am only interested in seeing 8% below the $100k and 8% above the $100k, I don't want to see 0, therefore setting the view between 92,000 and 108,000. i ahve tried using Vega and not much success, and from the research I have been doing this is not straight forward, or at least not for me.


Any help will be greatly appreciated.


Community Support
Community Support

Hi @tobyt 


You can take a look at the following steps that may help you.

  1. Pre-calculate Your Bounds within Power BI: Before you pass your data to the Vega-Lite visualization, use Power BI to create calculated fields that represent the lower and upper bounds of your desired y-axis range. For an account value of $100,000, with an 8% range:

    • Lower Bound = $100,000 - ($100,000 * 0.08) = $92,000
    • Upper Bound = $100,000 + ($100,000 * 0.08) = $108,000

    These calculations can be done using DAX in Power BI to create new fields in your data model.

  2. Adjust Vega-Lite Specification: With your bounds calculated, you'll then need to adjust the Vega-Lite specification within the Power BI Vega-Lite visual to use these bounds for the y-axis. Vega-Lite allows you to specify the domain of your axes, but this would typically involve static values rather than dynamic ones derived from the data. Since the dynamic computation is a bit tricky directly in Vega-Lite, relying on the pre-calculated bounds from Power BI is more straightforward.

  3. Example Vega-Lite Axis Configuration: Assuming you have calculated fields for your bounds, your Vega-Lite specification could manually set the domain of the y-axis to use these bounds. 







Best Regards,



If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi V-jialongy
thank you for your response, I have already two measures in Power BI for the lower and upper bounds, "MLL 8%" and "Profit Target Value", respectively. when I define the domain with these values the visual changes so that everything is concentrated at the top of the gauge/bar. In Power BI you can set the y scale to automatic so that the y scale starts at the lowest value of the dataset, and this is what I am trying to achieve here as well. The scale has to adjust so that the y scale starts at "MLL 8%", instead the y scale is starting at "0". From what I have read, and I am not the expert here, Vega-Lite is limited and that I should be using Vega. I have tried Vega with no success trying to follow examples, but I haven't come across one that matches my requirements. I prefer to use Vega-Lite, however if Vega is the answer then that is what I will have to use.
Any thoughts as to how this could be done using Vega instead?
many thanks in advance

Helpful resources

Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City


Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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