Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Compare two different values in QV 11

Hello,

I want to make a comparisson, could be in a chart, between the average of two different dates in QV 11.

How can I make that?

Thank you!

6 Replies
swuehl
MVP
MVP

Not quite sure what you want to compare, could you describe your data a bit more? Do you want to average two dates and compare it (to what?), or do you want to average values linked to one date and compare it to the average of values linked to another date?

You could maybe create a bar chart, with no dimension and two expressions:

= avg({<Date = {'$(vDate1)'}>} Value)

resp.

=avg({<Date = {'$(vDate2)'}>} Value)

where the two variables vDate1 and vDate2 hold the dates you want to compare.

Maybe like that?

Anonymous
Not applicable
Author

Yes, I want to average values linked to one date and compare it to the average of values linked to another date.

but can I do it for example, i want to compare this field pressure from january vs pressure from october?

swuehl
MVP
MVP

Should be not so difficult. I assume you want to compare month values across all years?

Create a field Month from your Date in the script using

Load

...

Pressure,

Date,

Month(Date) as Month.

...

from Table;

Then the two expressions could look like

=avg({<Month={Jan}>} Pressure)

resp.

=avg({<Month={Oct}>} Pressure)

where Jan and Oct are short month names according your standard format settings.

Anonymous
Not applicable
Author

Ok that worked great... but if i want the date that I select from a list... can I make 2 selections, and each one be assigned to a variable?

swuehl
MVP
MVP

You could try using Month as dimension in your chart and use as expression

=avg(Pressure)

So you could select which Month to compare from a Month List Box.

If you create a calculation condition (chart Properties, general tab),

=if(GetSelectedCount( Month ) =2,1,0)

you could force the user to select exactely two Month from the List Box (check out the custom error messages from general tab, too, to change the error message to something more meaningful: 'Please select two Months')

Anonymous
Not applicable
Author

Hi Juan

     You just create another one island Calender for and assign that value to any one of the  compare date variable

Regards

Ashok