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

If statement for graph values

Hi all,

I have the graph below and I was just wondering how I would write the script to see if any of these data points/values for each month are greater than 8?

 

I have tried:

 

If(aggr(count(frequency), date) > 8, 'True', 'False')

 

which does not work.

(The blue line should return false as no point along it are greater than 8 and the red should return true)

Any help would be greatly appreciated.

Labels (2)
3 Replies
MayilVahanan

Hi @JJ141 

Try with Month, instead of date

If(aggr(count(frequency), Month) > 8, 'True', 'False')

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
JJ141
Contributor II
Contributor II
Author

Hi @MayilVahanan thanks for the suggestion but unfortunately it didn't work.

The I have used data.autoCalendar.YearMonth as the x axis as the date is in dd/mm/yy format and it shows two groups.

 

Therefore I tried the following code you provided as well as:

If(aggr(Count(Frequency), date.autoCalendar.YearMonth, Group) > 8, 'True', 'False')

Which unfortunately also did not work.

 

Thanks

QFabian
Specialist III
Specialist III

Hi @JJ141 , you can create  a solution in the script, this is an example :

 

A:

Load

fields...,

frequency

from yoursource ;

 

B:

Load

MonthYear,

count(frequency)   as FrecuencyCount

from A

group by MonthYear;

 

C:

Load

MonthYear,

if(FrecuencyCount>8, 'Greater', 'Lower') as Status

from B;

 

 

Then you can create your chart using MonthYear and Status as dimensions, and sum(FrecuencyCount)   as expression.

 

QFabian