16 Replies Latest reply: Nov 8, 2017 12:22 AM by pranav gohil

# how to find the difference between measures of two selected bars in barchart?

example:

i want to find difference as

value in rupees in-

1984 = 43.44

1991 = 39.22

difference between them = 43.44 - 39.22 = 4.22

• ###### Re: how to find the difference between measures of two selected bars in barchart?

as a title or sub-title:

='difference btwn '&max(Year)& ' and '& min(Year)&' ='& (sum({<Year={"\$(=max(Year))"}>}Expression1) - sum({<Year={"\$(=min(Year))"}>}Expression1))

result:

• ###### Re: how to find the difference between measures of two selected bars in barchart?

='difference btwn '&max(Year)& ' and '& min(Year)&' ='

& (sum({<Year={"\$(=max(Year))"}>}avg(Wheat2)) - sum({<Year={"\$(=min(Year))"}>}avg(Wheat2)))

so this is my query after your suggestion but i want the average here in expression but its not allowing nested aggregation here.. please help

• ###### Re: how to find the difference between measures of two selected bars in barchart?

Just calculate max(year) and min(year) and write expression like this.

sum({<Year={"\$(=max(Year))"}>}[value in rupees]) - sum({<Year={"\$(=min(Year))"}>}[value in rupees])

• ###### Re: how to find the difference between measures of two selected bars in barchart?

value in rupees is = avg(wheat2)

• ###### Re: how to find the difference between measures of two selected bars in barchart?

Create new field in load script using avg(wheat2) as "Value in rupees" and use the same in formula as above mentioned.

• ###### Re: how to find the difference between measures of two selected bars in barchart?

maybe

='difference btwn '&max(Year)& ' and '& min(Year)&' ='

& (avg({<Year={"\$(=max(Year))"}>}(Wheat2)) - avg({<Year={"\$(=min(Year))"}>}(Wheat2)))

• ###### Re: how to find the difference between measures of two selected bars in barchart?

sorry but i forgot to say, i'm using alternate states in this charts so if u have any way of doing that using alternate states..??

• ###### Re: how to find the difference between measures of two selected bars in barchart?

what do you mean?

• ###### Re: how to find the difference between measures of two selected bars in barchart?

alternative measures?

• ###### Re: how to find the difference between measures of two selected bars in barchart?

every charts has different states so selection of one chart is not effecting the other charts .. so in such scenario i want to show the difference in two selected points on graph

• ###### Re: how to find the difference between measures of two selected bars in barchart?

and that's exactly what the expression does:

• ###### Re: how to find the difference between measures of two selected bars in barchart?

i understood the expression but i want this baased on different states

eg:

='difference btwn '&max(Year)& ' and '& min(Year)&' ='

& (avg(<STATE1>{<Year={"\$(=max(Year))"}>}(Wheat2)) - avg(<STATE1>{<Year={"\$(=min(Year))"}>}(Wheat2)))

• ###### Re: how to find the difference between measures of two selected bars in barchart?

check the qvf i've uploaded to understand the query..