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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Evaluate the three top values in a straight table

Hello everyone,

I have one issue that I do not know how to solve.

On the attached picture the is a straight table with several results.

A result can be positive (in green) or negative (in red).

What I need to do is count how many negative results are in the first 3 values of the table (the ones with the biggest hour), but I don't understand how.

table.png

I load my data from a database with sql.

I use the personal edition of QV.

Thank you.

Ivo

1 Reply
marchoctober
Creator
Creator

Hi! You should specify your issue in more detail,

What exactly are you looking for? Only first three record of the table neither they are positive or negative, and if they are negative to calculate them?

Or only first three negative values that appearing in data set among others, i.e. in your pic there are 10 green values and then two red, so for you result should be 2? Two negative values?

And where do you calculate negative and positive, in script or in UI using expression? Simple way is in script add Negative, Positive flag, f.e.

Table1:

Load

A,

B,

C,

if(C<0,0,1) as PNflag

from abc.dbo.....

In result you will see the table like that:

ABCPNflag
3316567891231
3317354887562231
331848564767-2220
3319474846-3330
3320-4440
33215551

So, using similar logic in script helps you further to count negative values in more esier way. This is true in order if you can identify positive or negative in script. In other way it will be more interesting solution using advanced formulas.