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

Find the difference in value between bars in bar chart

Hi,

I have a bar chart, consider the attached image.

I want to find the difference in the values between the bars in bar chart and show that value as a line chart in combo chart.

For example:

ID 1, Value 10

ID 2, Value 24

So the difference between them is 24-10=14

then

ID 3, Value 30

So the difference between them is 30-24=6

Like this, i want to show the difference value between them as a line or trend in the combo chart.

How can we achieve this?

15 Replies
sunny_talwar

May be like this (assuming your current expression is Sum(Sales))

Sum(Sales) - Above(Sum(Sales))

udaya_kumar
Specialist
Specialist
Author

Hi Sunny,

Thank you for the reply.

I am having two expressions in the bar chart and i have to find the difference between them.

PFA the snapshot of the bar chart with sample.

sunny_talwar

Earlier screenshot only showed one expression. Would you be able to provide a sample with the expected output? For a sample, qvw would be helpful to play around with

udaya_kumar
Specialist
Specialist
Author

PFA the sample qvw.

It shows two expressions, i want the difference between two bar values and show that as a trend in the same chart.

antoniotiman
Master III
Master III

Like this

(Alt(Sum(Value),0)+Alt(Sum(Value1),0))-Above(Alt(Sum(Value),0)+Alt(Sum(Value1),0))

sunny_talwar

Like this?

Capture.PNG

Expression:

If(Sum(Value) > 0, Sum(Value)-Above(Sum(Value)),

If(Above(sum(Value1)) = 0, Sum(Value1)-Above(Sum(Value)), Sum(Value1)-Above(sum(Value1))))

udaya_kumar
Specialist
Specialist
Author

Hi,

Sorry for that sample file.

I thought the logic which you have given will work in my actual file, but it did not work.

PFA the file which has the data similar to actual file.

Using this qvw, i want the same functionality.

The data has one bar for current data and other bars are for history data.

Please check this file and help me to get the difference between the bar values and show them as a trend.

udaya_kumar
Specialist
Specialist
Author

Sample excel file data used.

sunny_talwar

This?

Capture.PNG

Expression:

If(sum({<Flag={0}>} Value) > 0, sum({<Flag={0}>} Value)-Above(sum({<Flag={0}>} Value)),

If(Above(sum({<Flag={1}>} Value)) = 0, sum({<Flag={1}>} Value)-Above(sum({<Flag={0}>} Value)), sum({<Flag={1}>} Value)-Above(sum({<Flag={1}>} Value))))