Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
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.
Toby
Solved! Go to Solution.
Found a solution please visit the followin URL: powerbi - Setting a dynamic domain (min and max axis) in Vega-Lite (Deneb) - Stack Overflow
Hi @tobyt
You can take a look at the following steps that may help you.
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:
These calculations can be done using DAX in Power BI to create new fields in your data model.
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.
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,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Found a solution please visit the followin URL: powerbi - Setting a dynamic domain (min and max axis) in Vega-Lite (Deneb) - Stack Overflow
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
110 | |
95 | |
86 | |
78 | |
66 |
User | Count |
---|---|
157 | |
125 | |
116 | |
111 | |
95 |