Year Over Year Using Presentation Variables — Oracle Analytics

Oracle Analytics Cloud and Server

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

Year Over Year Using Presentation Variables

Received Response
11
Views
3
Comments
Matt_S
Matt_S Rank 3 - Community Apprentice

The user will prompt for a year.  I have set up a presentation variable to reference this prompt.  In the report I'm trying to set up a YOY filter referencing this presentation variable.  I want to show revenue results for current year and last year.  I'm was trying something like this: "Date"."Year" IN (@{var_year},@{var_year}-1).  It is not letting me do math here though without a function.  Does anyone know an easy way to do this?

Answers

  • Hi,

    In a IN() you can't do calculation, so why don't you turn it the other way?

           "Date"."Year" IN (@{var_year})

    OR "Date"."Year"+1 IN (@{var_year})

    PS: if your "Date"."Year" isn't a number you must CAST it as INTEGER before to do the +1

  • Matt_S
    Matt_S Rank 3 - Community Apprentice

    Thank you Gianni, this method has worked well!  I am still confused by why a +1 actually brings in the prior year.

  • Hi Matt,

    The +1 is because the prior year is last year, so "year" = @{var_year} - 1 is the same as "year" + 1  =@{var_year} (not sure how to call that in English but it's just a transformation of the "equation" doing +1 on both sides of the = ).