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

Be 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

Reply
babaci
Regular Visitor

Deneb: Fold bar, text marks don't line up correct at top af bars.

LocExecutedEstimatedProforma
A1.193 0
A3.894 0
A1.255 0
A3.044 0
A3.310 0
A342 0
A1.366 0
A805 0
A277 0
A873 0
B1.0515370
B24030
B4424440
B8989010
B8888790
B19430
B1.16411640
B9298660
B1.66116630
B1.2635250
C298 0
C304 0
C1.203 0
C703 0
C2.166 0
C416 0
C289 0
C1.466 0
C555 0
C699 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.

 

babaci_0-1678739438474.png

 

 

 

{
  "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"
        }
      }
    }
  ]
}

 

 

 

1 ACCEPTED SOLUTION

Hey @babaci, let me know if this will work. 

giammariam_0-1678753112476.png

Notes

  • once you bring this into deneb the pbiFormat for the labels should work
  • you'll want to adjust the width and height values

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!

 

gist can be found here

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"
            }
          }
        }
      ]
    }
  ]
}

 

 

 



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!

View solution in original post

4 REPLIES 4
giammariam
Super User
Super User

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



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!

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. 

giammariam_0-1678753112476.png

Notes

  • once you bring this into deneb the pbiFormat for the labels should work
  • you'll want to adjust the width and height values

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!

 

gist can be found here

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"
            }
          }
        }
      ]
    }
  ]
}

 

 

 



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!

@giammariam , thank you very much!! Works perfect.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Kudoed Authors