5 Replies Latest reply: Oct 6, 2016 12:20 PM by Peter Cammaert

Best Practice for filtering reports by variable

I have a variable for Current Year and Previous Year.  I am creating some reports that have a lot of expressions in them that are dependent upon one or both of these variables.  I am trying to figure out what is the best way to filter a report by just Current Year.  Should I used a calculated dimension?  Should I put the variable in each expression?  I want to be consistent and utilize the best practice.  Can someone please explain what is the best practice here?

• Re: Best Practice for filtering reports by variable

Can you post an example of your documents? It is rather difficult to post a best practice for something that is highly context-dependent. Thanks.

• Re: Best Practice for filtering reports by variable

I don't think a specific example will make much of a difference.  I'm just looking at it from an overall perspective.

 Store Sales Revenue 1 \$1,000,000.00 \$500,000.00 2 \$2,000,000.00 \$1,000,000.00 3 \$3,000,000.00 \$1,500,000.00 4 \$4,000,000.00 \$2,000,000.00 5 \$5,000,000.00 \$2,500,000.00

Take something as simple as this.  This data includes values from all years.  I want to be able to limit it to only the Current Year.  Is it best to use a calculated dimension, define the variable in each expression, or some other way?

• Re: Best Practice for filtering reports by variable

IMHO the easiest way to limit a chart to diplay just data for the current year is to use set analysis. But then again, I have no clue what the circumstances are.

• Re: Best Practice for filtering reports by variable

So, using Set Analysis, I would always need to define the value for that field.  Something like this...

Sum({\$<Year={2016}>}Sales)

• Re: Best Practice for filtering reports by variable

Not really. If you have a variable that defines "Current Year" in a numerical format (i.e. not as an expression) then you better use something like:

=Sum({\$<Year = {\$(vCurrentYear)}>} Sales)

This technique will perform a \$-sign substitution before evaluating the expression. It allows you to change the value of the Current Year without changing any expression.