Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
subbareddykm
Creator II
Creator II

Month and Qurater

HI All ,

I have a requirement , showing previour periods data on selection like one month and Quarters

Exp:

If  i slect Year=2018, I have Q1 and Q2 ,

For Q1 , Values should be Q4 of 2017.

For Q2 , Values should be Q1 of 2018.


If  i slect Year=2017, I have Q1 , Q2 , Q3 and Q4

For Q1 , Values should be Q4 of 2016.

For Q2 , Values should be Q1 of 2017.

For Q3 , Values should be Q2 of 2017.

For Q4 , Values should be Q3 of 2017.  and  so on...



Is it possible to achieve this in qlikview.




4 Replies
subbareddykm
Creator II
Creator II
Author

Hi All,

Is it possible to achieve  this ?

PrashantSangle

Hi,

try with below script

Data:

Load *,

'Q'&if(Right(Quarter,1)=4,1,Right(Quarter,1)+1) as newQ, 

if(Right(Quarter,1)=4,Year+1,Year) as NewYear;

LOAD Year,

     Quarter,

     Month,

     Exp

FROM

Data.xlsx

(ooxml, embedded labels, table is Sheet1);

Use NewQ and newYear for your reference.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
vishalarote
Partner - Creator II
Partner - Creator II

Hi Subbareddy,

Prashant is right...

You can use this also,

'Q'&if(Right(Quarter,1)=1,4,Right(Quarter,1)-1) as newQ,

if(Right(Quarter,1)=1,Year-1,Year) as NewYear;

create alternate state select different selection like

Year=2018 and Quarter=Q1 in inherit state

NewYear=2017 and NewQ=Q4 in state A

take two separate text box use Expression: sum(Exp) anyone to use alternate state A

Both values are match..Capture98.PNG 

subbareddykm
Creator II
Creator II
Author

Yah , this is working fine for Previous Quater  and i am using column as column one ,

also i have one more column for Current Quarter, If i show two columns and i select the Year its not working fine.

Exp

If i select the 2018

  

QuarterCurrentPrev

Logic

Q1100300Q4 2017
Q2200100Q1 2018