Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Display graph based on calculations

Hi All,

I am trying to display a graph based on some calculations. Lets say I have a table as below.

YearEmpIDVal1Val2
201312345060
201323213456

Lets say there are 3 categories Category A and Category B based on conditions like Val1 > x and Val2 <y etc..

I need to put each Employee in the any one of the category, either A or B.

Similar category I need to do it for past 2 years for the same employee. And finally based on A or B in the consequetive 2 years (2013, 2012), I need to assignment employee a color in a graph.

Questions:

1) Where to I write the script? In general edit script page or in the expression space particular to the graph ?

2) Can a value be stored so that when I choose details of different employees, I can still get the results of that particular employee only?

any other suggestions on implementing this function...

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

If the categories do not depend on selections made in the front end, then do the categories in the load script.  You will need something like this:

Let x = ....;

Let y = ....;

LOAD Year,

          EmpId,

          Val1,

          Val2,

          If(Val1 > x And Val2 < y, 'A',

          If(......, 'B',

          'C')) As Category

From ....;

This is just an example. You will need to adjust this script according to your requirements.

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Thanks, Jonathan.

It worked out with something similar your example.