Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

upaliwije
Contributor II

set Expression

sum( {$<[TO_YEAR] = {2014},[TO_MONTH]={'JAN'}>} [PREMIUM] )

The above expression is not working properly Can some one let me know whether any thing is incorrect with this expression

1 Solution

Accepted Solutions
Not applicable

Re: set Expression

Please, be more explicit. What does it mean "not properly" ?

Check the fields (low case, upper case) that they are written correctly. QV is case sensitive.

Fabrice

7 Replies
Not applicable

Re: set Expression

Please, be more explicit. What does it mean "not properly" ?

Check the fields (low case, upper case) that they are written correctly. QV is case sensitive.

Fabrice

luis_pimentel
Contributor III

Re: set Expression

Did you try '2014' with single quotes, like:

sum( {$<[TO_YEAR] = {'2014'},[TO_MONTH]={'JAN'}>} [PREMIUM] )

upaliwije
Contributor II

Re: set Expression

Although I select Year as 2014 results shown are for the year 2015

Not applicable

Re: set Expression

TO_YEAR and TO_MONTH are two dimensions?

upaliwije
Contributor II

Re: set Expression

Yea two dimensions

atsushi_saijo
Contributor II

Re: set Expression

I also have struggled in Dates. Even 'January' connotates 'January of 2013' if we handle it only with DATE([datefield],'MMM'). In my cautious loading script, I have created in such tools so that we would be ready for using any date range:

DATEFIELD AS H.DT.O,
IF(DATEFIELD>0,DATE(DATE#(DATEFIELD,'YYYYMMDD'),'(WWW) DDMMMYYYY')) AS H.DT,
IF(DATEFIELD>0,'W'&WEEK(DATE#(DATEFIELD,'YYYYMMDD'))) AS H.DT.W,
IF(DATEFIELD>0,'Q'&CEIL(MONTH(DATE#(DATEFIELD,'YYYYMMDD'))/3)) AS H.DT.Q,
IF(DATEFIELD>0,MONTHEND(DATE#(DATEFIELD,'YYYYMMDD'),0)) AS H.ME,
IF(DATEFIELD>0,MONTH(DATE#(DATEFIELD,'YYYYMMDD'))) AS H.MT,
IF(DATEFIELD>0,YEAR(DATE#(DATEFIELD,'YYYYMMDD'))) AS H.YR,

In such case, January means January of 1984......2014. Q1 means .... and so forth.

Please advise if this works for you.

mov
Esteemed Contributor III

Re: set Expression

The expression looks fine by itself.  Can you upload a sample of your application?