Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

padampadam
New Contributor

I'm getting a different results from Qlikview script and set analysis expression. Please let me know where i am doing a mistake.

I'm getting a different results from Qlikview script vs set analysis expression. Please let me know where i am doing a mistake.

Script Expression:

Count(DISTINCT If( (Col1>= Date(AddMonths(Today(), -1), 'DD/MM/YYYY') and Col1<= Date(Today(), 'DD/MM/YYYY'))

   AND ( LOGON_IND='Y' OR MOB_IND= 'Y' OR TBLT_ND='Y' OR FLG='Y' )

                    , NO))

SET Analysis Expression:

Count({$<Col1= {">=$(=Date(AddMonths(Today(), -1), 'DD/MM/YYYY'))<=$(=Date(Today(), 'DD/MM/YYYY'))"}> * (<LOGON_IND={'Y'}> + <MOB_IND={'Y'}> + <TBLT_IND={'Y'}> + <FLG={'Y'}> )}  DISTINCT NO)

5 Replies

Re: I'm getting a different results from Qlikview script and set analysis expression. Please let me know where i am doing a mistake.

Since I have no idea over which dimensions you aggregate this count in the script and in the charts I can't tell what's wrong. Perhaps you can post a small qlikview document that illustrates the problem.


talk is cheap, supply exceeds demand

Re: I'm getting a different results from Qlikview script and set analysis expression. Please let me know where i am doing a mistake.

Also do you know what the result should be ?

Otherwise deciding which is right and which is wrong will be tricky.

padampadam
New Contributor

Re: I'm getting a different results from Qlikview script and set analysis expression. Please let me know where i am doing a mistake.

There is no dimension. For some reason i can't post the document.

padampadam
New Contributor

Re: I'm getting a different results from Qlikview script and set analysis expression. Please let me know where i am doing a mistake.

Is it possible to let me know what other way i can write the OR condition with And logical operator.

* (<LOGON_IND={'Y'}> + <MOB_IND={'Y'}> + <TBLT_IND={'Y'}> + <FLG={'Y'}> )


Please refer below complete expression::

Count({$<Col1= {">=$(=Date(AddMonths(Today(), -1), 'DD/MM/YYYY'))<=$(=Date(Today(), 'DD/MM/YYYY'))"}> * (<LOGON_IND={'Y'}> + <MOB_IND={'Y'}> + <TBLT_IND={'Y'}> + <FLG={'Y'}> )}  DISTINCT NO)

Re: I'm getting a different results from Qlikview script and set analysis expression. Please let me know where i am doing a mistake.

Can you maybe create a master flag in the script?

If(LOGON_IND = 'Y' or MOB_IND = 'Y' or TBLT_IND = 'Y' or FLG = 'Y', 1, 0) as MasterFlag

and then use this expression:

Count({$<Col1= {">=$(=Date(AddMonths(Today(), -1), 'DD/MM/YYYY'))<=$(=Date(Today(), 'DD/MM/YYYY'))"}, MasterFlag = {1}>}  DISTINCT NO)

Alternatively, if the flags are residing in different tables, you can try this out as well:

Count({$

<Col1= {">=$(=Date(AddMonths(Today(), -1), 'DD/MM/YYYY'))<=$(=Date(Today(), 'DD/MM/YYYY'))"}, LOGON_IND={'Y'}> +

<Col1= {">=$(=Date(AddMonths(Today(), -1), 'DD/MM/YYYY'))<=$(=Date(Today(), 'DD/MM/YYYY'))"}, MOB_IND={'Y'}> +

<Col1= {">=$(=Date(AddMonths(Today(), -1), 'DD/MM/YYYY'))<=$(=Date(Today(), 'DD/MM/YYYY'))"}, TBLT_IND={'Y'}> +

<Col1= {">=$(=Date(AddMonths(Today(), -1), 'DD/MM/YYYY'))<=$(=Date(Today(), 'DD/MM/YYYY'))"}, FLG={'Y'}>}

DISTINCT NO)

Community Browser