Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
LINKEDIN LIVE: Democratizing data to enhance customer-centricity. JULY 29TH REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
martynlloyd
Partner
Partner

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
Partner
Partner
Author

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.

View solution in original post

7 Replies
michael_maeuser
Creator III
Creator III

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

senpradip007
Specialist III
Specialist III

Try this:

vMaxYear=Max(KPIYear)

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

Not applicable

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
Specialist II
Specialist II

Hi Martyn,

Try this,

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

martynlloyd
Partner
Partner
Author

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

martynlloyd
Partner
Partner
Author

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

martynlloyd
Partner
Partner
Author

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.

View solution in original post