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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
RvdH1212
Regular Visitor

DENEB - Problem with adding line to barchart

Dear all, @giammariam

As mentioned in earlier messages I've just became aware of DENEB. It works all well, however when i try to add a line to my barchart, where the line is very sawy, instead of the expected smooth line. can someone see where this happens?

Thanks a lot!

Result:

RvdH1212_0-1710760464787.png

Expection:

RvdH1212_1-1710760554108.png

Code:

 

{
"data": {"name": "dataset"},
"transform": [
{
"calculate": "datum['Total balance'] - datum['Threshold']",
"as": "value_difference_from_threshold"
},
{
"calculate": "datum.value_difference_from_threshold >= 0 ? datum['Total balance'] : 0",
"as": "value_above_threshold"
},
{
"calculate": "datum.value_difference_from_threshold < 0 ? datum['Total balance'] : datum['Threshold']",
"as": "value_below_threshold"
}
],
"layer": [
{
"description": "Bank",
"mark": {
"type": "bar",
"tooltip": true
},
"encoding": {
"x": {
"field": "Datum",
"timeUnit": "yearmonthdate",
"title": "Date",
"type": "nominal",
"axis": {
"labelAlign": "center",
"labelExpr": "[timeFormat(datum.value,'%d'),timeFormat(datum.value, '%d')=='01'?timeFormat(datum.value, '%b'):'']"
}
},
"y": {
"field": "value_below_threshold",
"type": "quantitative",
"title": "EUR",
"axis": {
"format": ".1s"
}
},
"color": {"value": "#F75555"},
"tooltip": [
{
"field": "Total balance",
"format": "#,##0.",
"formatType": "pbiFormat"
}
]
}
},
{
"description": "VALUE ABOVE THRESHOLD",
"mark": {
"type": "bar",
"tooltip": true
},
"encoding": {
"x": {
"field": "Datum",
"type": "ordinal",
"axis": {
"title": "Date",
"labelAngle": 0
}
},
"y": {
"field": "Threshold",
"type": "quantitative",
"title": ""
},
"y2": {"field": "Total balance"},
"color": {
"condition": {
"test": "datum.value_difference_from_threshold < 0",
"value": "transparent"
},
"value": "#3B4D41"
},
"tooltip": [
{
"field": "Total balance",
"format": "#,##0.",
"formatType": "pbiFormat"
}
]
}
},
{
"description": "THRESHOLD",
"mark": {
"type": "rule",
"strokeWidth": 0,
"color": "grey"
},
"encoding": {
"y": {
"field": "Threshold",
"type": "quantitative",
"aggregate": "mean"
}
}
},
{
"description": "Smooth Line",
"mark": {
"type": "line",
"color": "#FF7200",
"tooltip": true
},
"encoding": {
"x": {"field": "Datum", "type": "ordinal"},
"y": {"field": "7-days average", "type": "quantitative", "title": "Total Balance"}
}
}
]
}

 

Dataset:

DateCategoryTotal balance7-days averageThreshold
1-1-2024Volkswagen          369.563,212.609.3320
1-1-2024Green          335.582,6432.822.7410
1-1-2024Sweden          270.893,36895.6950
1-1-2024Brabant          128.544,42709.9050
1-1-2024Left          108.131,11785.7270
1-1-2024Glasses     -8.025.707,47-1.557.9330
2-1-2024Green      9.762.913,2931.457.6440
2-1-2024Sweden      3.280.134,871.021.9280
2-1-2024Volkswagen      2.529.806,592.559.4580
2-1-2024Brabant      1.858.963,39638.3680
2-1-2024Left          514.542,01757.9860
2-1-2024Glasses     -2.845.206,93-1.983.5180
3-1-2024Green    48.013.953,3132.339.1790
3-1-2024Volkswagen      4.993.542,982.654.5110
3-1-2024Sweden      1.185.068,441.024.9210
3-1-2024Brabant          976.708,42512.7630
3-1-2024Left          409.171,67724.0470
3-1-2024Glasses  -23.001.288,31-3.594.754

0

4-1-2024Brabant      8.365.657,51689.8870
4-1-2024Volkswagen      6.367.517,342.531.8660
4-1-2024Sweden      1.188.697,581.027.2100
4-1-2024Left          798.846,86661.0940
4-1-2024Green     -6.005.119,1629.123.2990
4-1-2024Glasses  -20.258.566,16-5.346.6700
5-1-2024Green    33.655.357,9627.680.4590
5-1-2024Brabant      3.310.081,38452.2960
5-1-2024Volkswagen      2.148.901,991.914.1670
5-1-2024Left          736.224,23531.8870
5-1-2024Sweden          606.978,87789.3980
5-1-2024Glasses  -36.690.735,70-8.341.1900
6-1-2024Green    33.693.879,0723.711.5030
6-1-2024Brabant      3.310.081,38502.6120
6-1-2024Volkswagen      2.148.901,991.989.2040
6-1-2024Left          736.224,23533.7600
6-1-2024Sweden          606.978,87765.7310
6-1-2024Glasses  -36.690.735,70-10.552.6170
3 REPLIES 3
lbendlin
Super User
Super User

Your sample data is a bit inconclusive - is this in general what you are looking for?

 

lbendlin_0-1710786184933.png

 

Hi Ibendlin,

 

Thanks for your response! Due to a lack of characters I had to reduce the example dataset. is there a posibility to provide more data? I cant do it in a regular message.

This is not exactly what i am looking for, the categories which are minus should be visible as minus and the categories in plus should be visible as plus. But the line is exactly how I want it.

 

So for 1 january:

1.212.714 and

-8.025.707

Where the negative amount (-8.025.707) is red and the plus amount (1.212.714) is green. This i wanted to achieve with the treshold function, which solved the problem. However, once adding the 7-days average line in the DENEB graph the line gets very sawy. Instead of the normal PowerBI Bar/Line chart, where it is smooth.

 

Thanks,

Richard

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors