Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

shahamel
Contributor

2 conditions within 1 expression

Dear users,

i came across a challenge. I would like to add another condition to this expression.It counts all the documents within a defined period. This period starts with vStardDate and ends with vEndDate. This expression works like a charm.

COUNT ({< UDATE = {'>=$(=Date(vStartDate))<=$(=Date(vEndDate))'} >} DOCUMENT_COUNT)

I use fourset statements within the load script:

SET vStartDate ='38353'; // Een integer dat hetzelfde is als: 18-10-2007
SET vEndDate ='40544'; // Een integer dat hetzelfde is als: 02-02-2012
SET ScorecardStart ='1'; //De eerste gedeinifeerde subset (zie SUBSETQUERY)
SET ScoreCardEnd ='39'; //De laatste gedeinifeerde subset (zie SUBSETQUERY)

But i would like to use another condition. I also want to be able to choose a scorecard. I made to set statements as seen above. I would like to do the same as i did with defining a period using vstartdate and vEndDate.

I try to use this expression, but it did not work. Anyone any suggestions?

COUNT ({< UDATE = {'>=$(=Date(vStartDate))<=$(=Date(vEndDate))'} >} and {< SCORECARDNUMBER = {'>=$(=ScorecardStart)<=$(=ScoreCardEnd)'} >} DOCUMENT_COUNT)

I added the complete file for better understanding.

1 Solution

Accepted Solutions
MVP
MVP

2 conditions within 1 expression

Hi,

Try the below expression, AND opertor is not allowed in Expressions.  If we want to give two conditions we just give the values in expression as comma separated.

For example:

=Sum({<Year={2010}, Month={'Jan'}>}Sales)

You can modify your expression as follows

=COUNT ({< UDATE = {'>=$(=Date(vStartDate))<=$(=Date(vEndDate))'} , SCORECARDNUMBER = {'>=$(=ScorecardStart)<=$(=ScoreCardEnd)'} >} DOCUMENT_COUNT)


Regards,

Jagan.

5 Replies

2 conditions within 1 expression

Hi,

     You cann't use and condition directly in set analysis.

    

COUNT ({< UDATE = {'>=$(=Date(vStartDate))<=$(=Date(vEndDate))'},SCORECARDNUMBER = {'>=$(=ScorecardStart)<=$(=ScoreCardEnd)'} >} DOCUMENT_COUNT)

Check with the above expression.

Celambarasan

MVP
MVP

2 conditions within 1 expression

Hi,

Try the below expression, AND opertor is not allowed in Expressions.  If we want to give two conditions we just give the values in expression as comma separated.

For example:

=Sum({<Year={2010}, Month={'Jan'}>}Sales)

You can modify your expression as follows

=COUNT ({< UDATE = {'>=$(=Date(vStartDate))<=$(=Date(vEndDate))'} , SCORECARDNUMBER = {'>=$(=ScorecardStart)<=$(=ScoreCardEnd)'} >} DOCUMENT_COUNT)


Regards,

Jagan.

shahamel
Contributor

2 conditions within 1 expression

Thanx

I used this expression. and it works perfectly fine

COUNT

({< UDATE = {'>=$(=Date(vStartDate))<=$(=Date(vEndDate))'},FIELD_NAME = {'Address' }>}DOCUMENT_COUNT)

Afterwards i also used your expression and that one also works like a charm

shahamel
Contributor

2 conditions within 1 expression

Hey,I have tried another dubble expression, but somehow it doesn't work

SUM

({< FROMDATE = {'>=$(=Date(vStartDate))<=$(=Date(vEndDate))'}, YEAR(FROMDATE) =

{

This quote above gives me trouble ad i don't understad why.

2010} >} ACTUAL2)

Could you help me?

Gr. Sandeep

2 conditions within 1 expression

Hi,

     You can use only field name to filter like FROMDATE in your expression.

     Set analysis doen't support the calculated field names for filter like Year(FROMDATE).

     To do this you have to create a separate field during the load like

     Load

          *,

          Year(Field) as YearField

     From..

Celambarasan

Community Browser