March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Loc | Executed | Estimated | Proforma |
A | 1.193 | 0 | |
A | 3.894 | 0 | |
A | 1.255 | 0 | |
A | 3.044 | 0 | |
A | 3.310 | 0 | |
A | 342 | 0 | |
A | 1.366 | 0 | |
A | 805 | 0 | |
A | 277 | 0 | |
A | 873 | 0 | |
B | 1.051 | 537 | 0 |
B | 2 | 403 | 0 |
B | 442 | 444 | 0 |
B | 898 | 901 | 0 |
B | 888 | 879 | 0 |
B | 1 | 943 | 0 |
B | 1.164 | 1164 | 0 |
B | 929 | 866 | 0 |
B | 1.661 | 1663 | 0 |
B | 1.263 | 525 | 0 |
C | 298 | 0 | |
C | 304 | 0 | |
C | 1.203 | 0 | |
C | 703 | 0 | |
C | 2.166 | 0 | |
C | 416 | 0 | |
C | 289 | 0 | |
C | 1.466 | 0 | |
C | 555 | 0 | |
C | 699 | 0 |
Hi,
Cannot seem to get the text mark on the right position, the need to be on the correct bar.
Any ideas on how I can get this solved...struggled but couldn't get it right.
Thanks.
{
"data": {"name": "dataset"},
"transform": [
{
"fold": [
"Executed",
"Estimated",
"Proforma"
],
"as": ["MoveType", "TotalMoves"]
}
],
"layer": [
{
"mark": {
"type": "bar",
"tooltip": true
},
"encoding": {
"y": {
"field": "TotalMoves",
"type": "quantitative",
"axis": {"title": null}
},
"x": {
"field": "Loc",
"type": "nominal",
"sort": "descending",
"axis": {"title": null}
},
"color": {
"field": "MoveType",
"type": "nominal",
"title": null,
"sort": "ascending",
"scale": {
"range": [
"#666685",
"#E3A611",
"#DE6A73"
]
}
},
"xOffset": {"field": "MoveType", "sort": "descending"}
}
},
{
"name": "Custom labels",
"mark": {
"type": "text",
"color": "black",
"angle": 0,
"baseline": "top",
"dy": -12
},
"encoding": {
"text": {
"field": "TotalMoves",
"formatType": "pbiFormat",
"format": "#0,,.00M"
},
"y": {
"field": "TotalMoves",
"aggregate": "sum"
}
}
}
]
}
Solved! Go to Solution.
Hey @babaci, let me know if this will work.
Notes
If this is enough to get you going, consider kudoing this reply and choosing it as the answer. If you need additional tweaks just let me know!
spec:
{
"width": 700,
"height": 400,
"data": {
"name": "dataset"
},
"transform": [
{
"fold": ["Executed", "Estimated", "Proforma"],
"as": ["MoveType", "TotalMoves"]
}
],
"layer": [
{
"encoding": {
"y": {
"field": "TotalMoves",
"type": "quantitative",
"aggregate": "sum",
"axis": {"title": null}
},
"x": {
"field": "Loc",
"type": "nominal",
"sort": "ascending",
"scale": {"padding": 0.2},
"axis": {"title": null, "labelAngle": 0}
},
"xOffset": {
"field": "MoveType",
"sort": "descending",
"scale": {"paddingInner": 0.1}
}
},
"layer": [
{
"name": "bars",
"mark": {"type": "bar", "tooltip": true},
"encoding": {
"color": {
"field": "MoveType",
"type": "nominal",
"title": null,
"sort": "ascending",
"scale": {"range": ["#666685", "#E3A611", "#DE6A73"]},
"legend": {
"orient": "none",
"direction": "horizontal",
"legendX": {"expr": "width/2-125"},
"legendY": {"expr": "height+25"}
}
}
}
},
{
"name": "Custom labels",
"mark": {
"type": "text",
"color": "black",
"angle": 0,
"baseline": "top",
"dy": -12
},
"encoding": {
"text": {
"field": "TotalMoves",
"type": "quantitative",
"aggregate": "sum",
"formatType": "pbiFormat",
"format": "#0,,.00M"
}
}
}
]
}
]
}
Hey @babaci, could you provide the column names that you have in your dataset and a few dummy rows (here's how)?
happy to help with this
Hi @giammariam , thanks for your response. I have updated the post and added a table. Let me know if you need more info.
Hey @babaci, let me know if this will work.
Notes
If this is enough to get you going, consider kudoing this reply and choosing it as the answer. If you need additional tweaks just let me know!
spec:
{
"width": 700,
"height": 400,
"data": {
"name": "dataset"
},
"transform": [
{
"fold": ["Executed", "Estimated", "Proforma"],
"as": ["MoveType", "TotalMoves"]
}
],
"layer": [
{
"encoding": {
"y": {
"field": "TotalMoves",
"type": "quantitative",
"aggregate": "sum",
"axis": {"title": null}
},
"x": {
"field": "Loc",
"type": "nominal",
"sort": "ascending",
"scale": {"padding": 0.2},
"axis": {"title": null, "labelAngle": 0}
},
"xOffset": {
"field": "MoveType",
"sort": "descending",
"scale": {"paddingInner": 0.1}
}
},
"layer": [
{
"name": "bars",
"mark": {"type": "bar", "tooltip": true},
"encoding": {
"color": {
"field": "MoveType",
"type": "nominal",
"title": null,
"sort": "ascending",
"scale": {"range": ["#666685", "#E3A611", "#DE6A73"]},
"legend": {
"orient": "none",
"direction": "horizontal",
"legendX": {"expr": "width/2-125"},
"legendY": {"expr": "height+25"}
}
}
}
},
{
"name": "Custom labels",
"mark": {
"type": "text",
"color": "black",
"angle": 0,
"baseline": "top",
"dy": -12
},
"encoding": {
"text": {
"field": "TotalMoves",
"type": "quantitative",
"aggregate": "sum",
"formatType": "pbiFormat",
"format": "#0,,.00M"
}
}
}
]
}
]
}
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.