Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nihhalmca
Specialist II
Specialist II

Show Previous Quarter data in Table Chart

Hi All,

I  am facing issue at Set analysis to get previous quarter [max(Quarter)-1] data when we select Quarter [max(Quarter)].

I have data format (YYYYMM) from that I derived Year (YYYY), Quarter(Q1) and  YearQtr (YYYYQ like 20191..) fields.

Written expressions in chart as below:

Sum({<YearQtr = {$(vPreviousQtr)}} Sales) - tried single, double and no quotations at variable.

VPreviousQtr = If(Right(YearQtr) = 1,  YearQtr-7, YearQtr-1) = It will show previous quarter.

 

And I tried with "autoCalendar" as well to get date fields.

I used "QuarterAgo" field in set analysis instead of YearQtr which has Quarter Numbers (starting with 0 like current quarter is '0'.

App has only Year and Quarter filters to select by users.

With above to ways i could not get previous quarter data by selected Quarter [max(quarter)].

Could you please assist with if you have any idea.

Thanks, Nihhal. 

 

6 Replies
tresesco
MVP
MVP

Nihal,

Say your max quarter is 20191 (YYYYQ - as you mentioned). Now you try to get the previous quarter from this probably by simply subtracting 1 something like : Max(Quarter)-1. Then what do you get ? It's 20191-1 = 20190. However, you expected the previous quarter, i.e. - 20184 . So that's the catch.

nihhalmca
Specialist II
Specialist II
Author

Hi Tresesco - thanks for your response.

I am using below srcript to get previous quarter same mention in my question.

VPreviousQtr = If(Right(YearQtr) = 1,  YearQtr-7, YearQtr-1) = It will give previous quarter.

tresesco
MVP
MVP

Sorry, somehow I missed that you mentioned in your post above.

You meant:

VPreviousQtr = If(Right(YearQtr, 1) = 1,  YearQtr-7, YearQtr-1)              right?

nihhalmca
Specialist II
Specialist II
Author

Yes.

I  believe that something went wrong while passing variable or hard coded  in set analysis.

tresesco
MVP
MVP

So this resolved your issue...or still persists. If not resolved, could you share a sample app or few screenshots showing the issue?

nihhalmca
Specialist II
Specialist II
Author

Hi Tresesco, i could not copy screen shots from client sever/rdp and still not resolved issue.

Issue at set analysis as i mention in question there is any mistake in script? (set analysis) i did not see any error message but it is not working at chart or text box objects.