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

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

set analysis with >, >=, <, <= operators

Can anyone tell met how to use the >= operator in setanalysis?

want to find the sum of sales between to dates.

Regards,

Lambert.

9 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    The operators have the same meaning in set analysis too..

    In your case the i.e sum between two days, you will be using them in below way.

    sum({<Date = {">=Start Date <= End Date"}>}Sales)

    Here when you use >= and <= it will include the mentioned date, but if you use < and > then it will exclude the mentioned date.

    Hope this is clear to you.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Hi Lambert,

the following code calculates the sum of sales between 01 Jan 2010 to 01 Jan 2011.

sum( {<Date={">=2010-01-01 <= 2011-01-01"}>} Sales)


if you want to use variables (or fields) just replace the dates with the corresponding variables or fields.

for example, the following calculates the sum of sales between two dates stored in two variables.

sum( {<Date={">=beginDate <=endDate"}>} Sales)


Rgrds,

Abhinava

SunilChauhan
Champion II
Champion II

this is used for greater than or eqaual to, sometimes for excluding seleection

sum({<Date={">=$(=Max(date))"}>} -----> greater than or euals to

sum({<date>=,gm={'Anil'} amout} excluding seletion of date

on base of above you can identify beelow

>

>=

<=

<

regards

Sunil Chauhan

Sunil Chauhan
Not applicable
Author

excellent!,

Thanks for feedback guys.

Lambert.

Not applicable
Author

Hi there,

following up on this question i have a similar problem to solve:

I want to count all xDates where xDate is after yDate.

I tried it this way:

count({$<status={active}, xDate = {">=xDate >= yDate"}>} xDate)

...but it does not work. returns 0.

(xDate and yDate are not fields of the same table...)

Thanks for any hints!

K

SunilChauhan
Champion II
Champion II

hope this helps you

count({$<status={active}, xDate = {" >= yDate"}>} xDate)

Sunil Chauhan
Not applicable
Author

hi kalinkula,

your expression is logically incorrect.

try the following code...

count({$<status={active}, xDate = {">= yDate"}>} xDate)


Rgrds,

Abhinava

Not applicable
Author

thanks for the quick reply. unfortunately it still returns 0. i simplified the expr:

count({$<xDate = {" > yDate"}>} xDate)   --> returns 0

but

count ( if (xDate > yDate, xDate ) )     --> returns 260

How come ?

Thanks a lot!

K

Not applicable
Author

hi Kalinkula,

for the first expression to work, there should be atleast o ne selection in the yDate field.

the second expression works because it is calculating all the possible combinations where xDate  is greater than yDate.

Rgrds,

Abhinava