Hello!
How to do a proper calculation to get a previous quarter value using passed presentation variable? I have @{Quarter} in my prompt which passes a quarter for "Sales - CRM Pipeline"."Time".Enterprise Quarter" and then using this variable I want to get a previous quarter for
"Sales - CRM Historical Pipeline"."Pipeline Snapshot Date"."Pipeline Snapshot Enterprise Quarter". And for this im using:
CASE WHEN RIGHT('@{QUARTER}', 1) = '1' THEN CAST(CAST(LEFT('@{QUARTER}', 4) AS INTEGER) -1 AS CHAR)||' '||'Q'||' '||'4' ELSE CAST(CAST(LEFT('@{QUARTER}', 4) AS INTEGER) AS CHAR)||' '||'Q'||' '||CAST(CAST(RIGHT('@{QUARTER}',1) AS INTEGER)-1 AS CHAR) END
and it gives me a proper calculated result (for example 2017 Q4 if @QUARTER is 2018 Q1)
But then when I try to use it in my filter like that:
"Pipeline Snapshot Date"."Pipeline Snapshot Enterprise Quarter" IN (CASE WHEN RIGHT('@{QUARTER}', 1) = '1' THEN CAST(CAST(LEFT('@{QUARTER}', 4) AS INTEGER) -1 AS CHAR)||' '||'Q'||' '||'4' ELSE CAST(CAST(LEFT('@{QUARTER}', 4) AS INTEGER) AS CHAR)||' '||'Q'||' '||CAST(CAST(RIGHT('@{QUARTER}',1) AS INTEGER)-1 AS CHAR) END
The analysis gives me no results. And I have data in snapshots for many quarters so I dont know why it behaves like this....
Will aprreciate help
Alex