Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello,
I have a 100% stacked bar chart that displays per country the product sales. (I've reduced my products in the top 3, so that for each country i have these only). I want to add next to each line (country) the value that corresponds to the revenue per country but in total for all products. Is it possible?
Not with the standard visuals. Use Deneb or similar to create your own visual .
So, the only option I actually have is to create a custom visual. Do you think that i could it maybe using python code?
if that Python code renders the chart, yes.
I tried this code, but it does not display the visual as I expect:
I want in axe Y the countries and then display the apples, lemons and oranges in a 100% stacked bar chart. At the end of each bar to display as label the revenue for each country
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {"name": "dataset"},
"transform": [
{
"calculate": "datum['apples'] + datum['oranges'] + datum.lemons",
"as": "total"
},
{
"stack": "total",
"as": ["bottom", "top"]
}
],
"mark": "bar",
"encoding": {
"y": {
"field": "Country",
"type": "nominal"
},
"x": {
"field": [
"apples",
"oranges",
"lemons"
],
"type": "quantitative",
"stack": "normalize",
"axis": {"format": ".0%"}
},
"color": {
"field": "revenue",
"scale": {"scheme": "redblue"}
},
"opacity": {
"condition": {
"test": {
"field": "__selected__",
"equal": "off"
},
"value": 0.3
},
"value": 1
},
"tooltip": [
{
"field": "apples",
"title": "apples"
},
{
"field": "oranges",
"title": "oranges"
},
{
"field": "lemons",
"title": "lemons"
}
]
}
}
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
81 | |
53 | |
37 | |
35 |