Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
dia2021
Creator
Creator

Current Quarter minu Previous Quarter

Hi All,

I need to calculate the numbers for the current quarter minus the previous quarter. I'm not sure how I can get the right values. I came across multiple blogs regarding date calculations; however, none has worked so far. I'm using this expression for the current month, which is working fine

 =sum({<QuarterYear={'$(=MaxString(QuarterYear))'}>}budget)

the same syntax is not working for the previous quarter  =sum({<QuarterYear={'$(=MaxString(QuarterYear)-1)'}>}budget)

Could anyone please their thoughts on this? How can I make it work?

Labels (2)
2 Replies
chinmayadash07
Contributor II
Contributor II

I would suggest create two variable in master calender for better perforamnce like.

Set VCurrentQtr='q' & ceil(month(today())/3)&year(today())

Set vPreviousqtr='q' & ceil(month(addmonth(today())())/3)&year(addmonths(today(),-3))

Create quarter Year in your mastercalender

'q' & ceil(month(orderdate)/3)&year(orderdate)

Create a Variable in Front end

vSalesQoQ=sum({<QuarterYear={$(VCurrentQtr)}>}Sales)-sum({<QuarterYear={$(vPreviousqtr)}>}Sales)

 

and use the vSalesQoQ on your chat where you require

 

dia2021
Creator
Creator
Author

Hi  Chinmayadash,

Thanks for the reply! I have created these variables at the data load editor and its not working. 

Set VCurrentQtr='q' & ceil(month(today())/3)&year(today())

Set vPreviousqtr='q' & ceil(month(addmonth(today())())/3)&year(addmonths(today(),-3))

Thank you for your help.