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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to select previous quarter from ref table

Hi,

I have a ref table like the following.

Month_No, Month, Quarter
1 , Jan , Q1
2, , Feb , Q1
5 , May, , Q2

Qns 1:
I'm trying to create a text object to determine current month so i can get the quarter value.
i tried using pick(), but it requires me to make selection on month first.
i wanted it to be no selection because it's a fixed text box.

Qns 2:
Based on the above table structure, to determine previous Q,
Now is Jan 2011, so previous Q should be 'Q4 2010'.

Thanks

4 Replies
martin59
Specialist II
Specialist II

Hello,

You have to use the QuarterName() function :

QuarterName(Today())


Not applicable
Author

But the value i'm trying to get is in Q1 . Q2 ....

QuarterName returns Jan-Mar 2011.

Not applicable
Author

If i do this , it is able to detect the correct quantity of the value.

and now i just need to make the value to show.

any idea?

=COUNT({$<MONTH={'$(=month(today()))'}>} Quarter)


Not applicable
Author

Hello,

You can try a autonumber.
Based on Year, Month and Quarter.


Load
Autonumber(Year, Month, Quarter) as OrderQuarter
Resident Master_Calendar;


After, you can make a subtraction to get the previous quarter, with set analyis.


Sum({$<OrderQuarter={$(=(Max(OrderQuarter))-1)}>} Sales)
Only({$<OrderQuarter={$(=(Max(OrderQuarter))-1)}>} Quarter)