# 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
Did you mean:
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
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.

7 Replies
Creator III

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

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])

Specialist II

Hi Martyn,

Try this,

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

Partner
Author

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

Partner
Author

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

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.

Community Browser