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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
stevejones1
Contributor III
Contributor III

Previous Quarter

Hi

I need to create 2 variables to get the Max Quarter and the previous quarter

MY EXPRESSION :

(Max Quarter - Previous Quarter)

/Previous Quarter

i am able to get max quarter by using =MaxString(YrQtr) but cannot get previous quarter

Please find the attached app

Thanks

Labels (1)
16 Replies
Nagaraju_KCS
Specialist III
Specialist III

Try like below..

vMaxQuarter = Ceil(num(month(max(OrderDate)))/3)

vPriorQuarter = Ceil(num(month(addmonths(max(OrderDate),-3)))/3)

passionate
Specialist
Specialist

Hi Steve,

Previous Quarter as

=pick(match(MaxString(Quarter),'Q1','Q2','Q3','Q4'),'Q4','Q1','Q2','Q3')

Regards,

Pankaj

stevejones1
Contributor III
Contributor III
Author

Please take a look at attached app

My quarter formats are like FY17-Q4, none of the above expressions work for previous quarter value.

Please help!

sasiparupudi1
Master III
Master III

Hi Steve,

I suggest you make your fiscal quarter field a dual or create a new field fiscalquarterPeriod using the autonumber so that you can easily use "max" function to get to the max periods

ex:

Dual(YrQtr,AutoNumber(YrQtr,'YrQtr')) as YrQtr

or

AutoNumber(YrQtr,'YrQtr')) as YrQtrPeriod

hth

Sasi

stevejones1
Contributor III
Contributor III
Author

easy solution 🙂

tresB
Champion III
Champion III

One front-end solution could be:

=FirstSortedValue( YrQtr,-Aggr(Max(Mid(YrQtr,3,2)*10+Right(YrQtr,1)),YrQtr),2)

Capture.JPG

sasiparupudi1
Master III
Master III

Please close the thread by marking a correct answer