Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need help with previous Quarter period

Hi All,

I have one field period like 2015-Q1, 2014-Q4 , 2014-Q3 ... etc.

so i want current period comparison 2015-Q1 and previous period 2014-Q4 data. so any one can tell how can i achieve this ??

Thanks in advance !!

Deepak

Labels (1)
11 Replies
giakoum
Partner - Master II
Partner - Master II

number the periods so that you can reference the previous one in set analysis as current-1:

1     2014Q1

2     2014Q2

3     2014Q3

4     2014Q4

5     2015Q1

etc

Not applicable
Author

HI

Thanks for reply but not working !!

Deepak

jagan
Partner - Champion III
Partner - Champion III

Hi,

If you attach sample then it would be easier to provide the solution.  You need to create a date field from the Quarter and then you need to use Set Analysis expression for get the previous Quarter value.

Regards,

Jagan.

Anonymous
Not applicable
Author

Take a look at function InQuarter().  Examples:

sum(if(InQuarter(Today(),DateField, 0), Amount)) - returns sum(Amount) for the current Quarter

sum(if(InQuarter(Today(),DateField, -1), Amount)) - returns sum(Amount) for the previous Quarter

Not applicable
Author

Hi Jagan,

  • Please find attached qvw.
tresB
Champion III
Champion III

Ideally, this should have been taken care into the script itself by generating dual quarters. However, a workaround in the front end using string comparison, could be like in attached sample.

=sum({$<Period ={"$(=Year(QuarterStart(Date#(Period, 'YYYY-QM'),-1))&'-Q'&Ceil(Month(QuarterStart(Date#(Period, 'YYYY-QM'),-1))/3))"} >}Sales)

Not applicable
Author

Hi Tresesco, Thanks for help but i m not getting output which i want when i selecting any other period it not went to previous period same year.

Not applicable
Author

Hi Tresesco, When you do the selection 2014-Q4, than it giving the value of 2014-Q1 so earlier i said it not went to previous quarter.

tresB
Champion III
Champion III

Sorry, corrected.

PFA

=sum({$<Period ={"$(=Year(QuarterStart(Date#(Left(Period,4)&Right(Period,1)*3, 'YYYYM'),-1))&'-Q'&Ceil(Month(QuarterStart(Date#(Left(Period,4)&Right(Period,1)*3, 'YYYYM'),-1))/3))"} >}Sales)