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

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
128718
Contributor II
Contributor II

Need to get previous quarter value for the selection quarter

 Hi Team, 

My requirement is when I select Q4-2021 in filter I should get Q3-2021(measured value) in KPI object similarly when I select Q3-2021 I should get Q2-2021(measured value) in KPI object.

I have tried

count({<Date={">=$(=QuarterStart(Max(Date),-1))<=$(=QuarterEnd(Max(Date),-1))"}>} sales)  as my measure

but got 

128718_2-1633000371398.png

Expected output:

128718_1-1633000753156.png

 

Could you please help me to achieve the above requirement.

 

Thanks

 

11 Replies
abhijitnalekar
Specialist II
Specialist II

Hi @128718 ,

 

Please follow the below steps to get the required output.

1. Create  new dimension in the script as  Ceil(Month(SatrtDate)/3) as Quart

2. Create 2 variables as maxq with expression : =max(Quart) and PrevQ as expression  : =max(Quart)-1

3. write a expression in KPI as measure for current Quarter :  count({<Quart={"$(maxq)"}>}ID) and

prev Quarter as  count({<Qart={"$(PrevQ)"}>}ID)

 

Hope this helps you.

Regards,
Abhijit
keep Qliking...
Help users find answers! Don't forget to mark a solution that worked for you!
abhijitnalekar
Specialist II
Specialist II

Hi @128718 ,

 

Please follow the below steps to get the required output.

1. Create  new dimension in the script as  Ceil(Month(SatrtDate)/3) as Quart

2. Create 2 variables as maxq with expression : =max(Quart) and PrevQ as expression  : =max(Quart)-1

3. write a expression in KPI as measure for current Quarter :  count({<Quart={"$(maxq)"}>}ID) and

prev Quarter as  count({<Qart={"$(PrevQ)"}>}ID)

 

Hope this helps you.

Regards,
Abhijit
keep Qliking...
Help users find answers! Don't forget to mark a solution that worked for you!