Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Create filter from calculated field

Hi guys,

          this is the situation, i've a table like this

idinoutresult
a14113
b1723-6
c865630
d433211

this is the load script:

LOAD id,

          in,

          out

FROM ....

and result = in - out

Now i'd like a filter where i can group the result value, for example:

result < 0

result > 0 and result < 10

result > 10 and result < 20

result > 20 and resul < 30

so i can filter only the values that i want.

Can i create a filter on the calculated field "result"?

10 Replies
Mark_Little
Luminary
Luminary

Hi,

I would first in script use the Peek function to calculate your Result column.

Something like

LOAD Date,

     IN,

     Out,

     IF(ROWNO()=1,

             IN - Out,

             Peek(Result,-1)+ (IN - Out)

         )                                         AS Result      

FROM YourTable,

Then you could either do a proceeding load and use an if statement to calculate your buckets or front end use the Class() Function to so the result in the buckets.

A Deminsion some like

CLASS(Result,10,'Bucket')

Mark