7 Replies Latest reply: Jul 17, 2014 7:22 AM by Martyn Lloyd

# 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?

• ###### Re: Set analysis syntax

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

• ###### Re: Set analysis syntax

Try this:

vMaxYear=Max(KPIYear)

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

• ###### Re: Set analysis syntax

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

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

• ###### Re: Set analysis syntax

Hi Martyn,

Try this,

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

• ###### Re: Set analysis syntax

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

• ###### 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.