Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

martynlloyd
Contributor III

Set analysis syntax

I have an expression:

({$<Domain={'Sales'}, [Dealer Type]={'SSP'}, [KPIID]={'S10','S11A','S11B'}, KPIYear={2013, 2014}>} Result)

I have a field CurrentYear, and I want to use CurrentYear-1 and CurrentYear instead of the fixed values, please can you help me get the correct syntax?

1 Solution

Accepted Solutions
martynlloyd
Contributor III

Re: Set analysis syntax

Thanks everyone, I've solved it by creating two variables: vCurrentYear, vPreviousYear

Sum({$<Domain={'Sales'}, [Dealer Type]={'SSP'}, [KPIID]={'S10','S11A','S11B'}, KPIYear={$(vPreviousYear), $(vCurrentYear)}>} Result)

Regards,

Marty.

7 Replies
michael_maeuser
Contributor III

Re: Set analysis syntax

is it a variable? then you can do like this sum({<year={'$(CurrentYear)-1'}>} value)

senpradip007
Valued Contributor III

Re: Set analysis syntax

Try this:

vMaxYear=Max(KPIYear)

Sum({$<Domain={'Sales'}, [Dealer Type]={'SSP'}, [KPIID]={'S10','S11A','S11B'}, KPIYear={$($(vMaxYear)-1)), $(vMaxYear)}>} Result)

Not applicable

Re: Set analysis syntax

1st if there is only one current year this value should be store in a variable not field. so you can use the variable with $(). your case will be Year = { $(CurrentYear) }.

If your current year is a a field for some reason. I think you should use P(). Year = P({$} [Current Year])

vishalwaghole
Valued Contributor II

Re: Set analysis syntax

Hi Martyn,

Try this,

sum({$<Domain={'Sales'}, [Dealer Type]={'SSP'}, [KPIID]={'S10','S11A','S11B'}, KPIYear={'$(CurrentYear)-1',{'$(CurrentYear)'}}>} Result)

martynlloyd
Contributor III

Re: Set analysis syntax

Thanks, but this still gives a syntax error (red underline) and only returns the current year.

martynlloyd
Contributor III

Re: Set analysis syntax

Thanks, but this still gives a syntax error (red underline).

martynlloyd
Contributor III

Re: Set analysis syntax

Thanks everyone, I've solved it by creating two variables: vCurrentYear, vPreviousYear

Sum({$<Domain={'Sales'}, [Dealer Type]={'SSP'}, [KPIID]={'S10','S11A','S11B'}, KPIYear={$(vPreviousYear), $(vCurrentYear)}>} Result)

Regards,

Marty.

Community Browser