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: 
Not applicable

How to get Previous Quarter

hi everyone,

I m able to get the Previous year Value ...sum({$<Year = {$(=max(Year))}>}Price_Pcs_Incl_Discount..

on the same basis i want to get Previous Quarter Value as well..LIke when i select Q4,, I can see value of Q4 and Q3..

12 Replies
Not applicable
Author

Hi,

VPrevQuarter=peek('Quarter');

or

VPrevQuarter=previous(getfieldselections(Quarter))

sum({$<Quarter = {'$(VPrevQuarter)'}>}Price_Pcs_Incl_Discount..

maxgro
MVP
MVP

add a new field to your calendar (if any), then use set analysis on the new field (as you did for year, quarter is max(new field)-1)

                    new field

2010Q1          1

2010Q2          2

.....

2011Q1          5

....

2015Q4          20

2015Q1          21            

Not applicable
Author

hi shravan,

its not working .. i m not getting and Value.. i m Able to do a for Current Quater..

.sum({$<Quarter= {$(=max(Quarter))}>}Price_Pcs_Incl_Discount..



But i want for last Quarter// Like if i select Quarter3 and i get value of Quarter2

Not applicable
Author

Hi Maurya,

Create a Date field and then try like this

sum({$<Date = {">=Quarterstart(Date,-1)<=Quarterstart(Date)"}>}Price_Pcs_Incl_Discount...


Thanks

Harsha Nandan



Not applicable
Author

its not giving a Proper Value..can u send me any other way to do this

tresesco
MVP
MVP

It majorly depends on metadata format. Try to create your sample qvw and share.

Not applicable
Author

Are you directly getting the Quarter field or otherwise calculated from the date field?

Not applicable
Author

i m Calulating...

QuartersMap: 

MAPPING LOAD  

rowno() as Month, 

'Q' & Ceil (rowno()/3) as Quarter 

AUTOGENERATE (12); 

what i want .. if i clik year say 2015 and select Q4.. it show sum of sales for Q4 and Q3.. as well when i click Q1 it shows Q4 of 2014..

Not applicable
Author

If you create like this..I think it will forms a data island ...because of this it is not showing data exactly...