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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register 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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors