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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
dunnalahk123
Creator III
Creator III

Rolling 5 Quarters

Hi,

I need to take always 5 rolling Quarters in my data.

first variable i created is to get latest quarter

=Chr (39) & Maxstring( {<ScenarioLabel={'Actuals'}>} Quarter) & Chr (39)

Which gives me 2018-Q1

then i did as below

=$(vMaxQuarterRolling) - 10 to get 2017-Q1

but i am not getting that value. is it some thing i did some mistake , can some one help me here pls.

Best Regards,

Hk

1 Solution

Accepted Solutions
dunnalahk123
Creator III
Creator III
Author

HI,

I Wrote as below

=MID($(vMaxQuarterRolling) ,1,4)-1 &'-' & MID($(vMaxQuarterRolling) ,6,2)

Best Regards

Hk

View solution in original post

5 Replies
YoussefBelloum
Champion
Champion

Hi,

do you have a master calendar on your model ?

raajaswin
Creator III
Creator III

Hi Hk,

create a column in script with

keepchar(columnname,'0123456789') as YR_QTR_NUM

now you will have numbers with you

then get last five quarter with with max(YR_QTR_NUM,1) ,max(YR_QTR_NUM,2) , max(YR_QTR_NUM,3), max(YR_QTR_NUM,4), max(YR_QTR_NUM,5)

Anil_Babu_Samineni

MaxString is not the solution your case, Even thought this can be done i assume you may need AddYears()?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
dunnalahk123
Creator III
Creator III
Author

HI,

I Wrote as below

=MID($(vMaxQuarterRolling) ,1,4)-1 &'-' & MID($(vMaxQuarterRolling) ,6,2)

Best Regards

Hk

Anil_Babu_Samineni

do you really think, Does this job done? Because, For me not make sense. Instead i would suggest you to do script level to bifurcate each and level.

Anyway, you got work. That is awesome !!!

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful