I am trying to take results from a csv dump file and present them in PowerBI as a more accessible way of analyzing the data. I haven’t used PowerBI before but quickly found the default visualization to be woefully lacking so it was recommended to go to Deneb as a better tool.
I was trying to make a stacked bar chart to look at several parameters in the comparison the result from native PowerBI was pretty hilarious tbh and totally unreadable
Not sure what is going on here and why it left 2/3rds of the space empty but this could not be remedied so I moved on to Deneb. A subset of my data is posted below but this goes through several transformations on input to PowerBI
Sample Data
The transformations consist of:
- Clarifying variable types (text, numbers, dates)
- Transposing the table
- Creating a new field to aggregate some of the fields
- Adding zeroes to replace null for easier subsequent analysis
From here I would like to create a single vertical bar chart that allows me to show these values as individual labeled bars. When loading into Deneb I have selected the sums of all the values (I am interested in looking at aggregates for now) and my source data ends up being a dataframe with a single row of sums and each column header being the appropriate label which seems appropriate to use for my current needs.
From here using the template from the examples that seems best suited for my needs I feel like I should be able to generate this chart but I am getting hard stuck.
Preferred template
I can add one of the fields to the x-axis but don’t seem able to add an additional one or get the labels correct without running into errors. Is there something I should be doing to call/import the data more correctly in order to get a stacked bar chart?
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A bar chart with negative values. We can hide the axis domain line, and instead use a conditional grid color to draw a zero baseline.",
"data": {"name": "dataset"},
"encoding": {
"y": {
"field": "Loss Parameter",
"type": "nominal",
"axis": {
"domain": false,
"ticks": false,
"labelAngle": 0,
"labelPadding": 4
}
},
"x": {
"field": "Sum of Transposition",
"type": "quantitative",
"scale": {"padding": 20},
"axis": {
"gridColor": {
"condition": {"test": "datum.value === 0", "value": "black"},
"value": "#ddd"
}
}
}
},
"layer": [
{"mark": "bar"},
{
"mark": {
"type": "text",
"align": {"expr": "datum.b < 0 ? 'right' : 'left'"},
"dx": {"expr": "datum.b < 0 ? -2 : 2"}
},
"encoding": {"text": {"field": "b", "type": "quantitative"}}
}
]
}
I would eventually like to generate some box and whisker plots for each parameter as well as highlight the largest values for error checking which makes me think I want to avoid the auto-summation done by PowerBI for the data so if there is a way to do that in the code as well to allow me to work with raw data that would be helpful.
Thanks!