Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
ckmchinmaya
Contributor III
Contributor III

Current vs Previous Quarter - Capture Delta (+/-)

Hi Guys,

I have a requirement to show delta / net movement of values between Current Quarter ( Or  any Selected Quarter ) with its previous quarter.

There is a possibility - we can't have quarters in sequence. Mostly we don't have Q4 datasets. So, if we need to compare between Q1'2019 then its previous quarter is Q3'2018. So, its purely based on user selection to select a current quarter.

I have values like 2017' Q4, 2018' Q1, 2018' Q2, 2018' Q3, 2019' Q1 & 2019' Q2. As I receive the value from a dataset as is, there is no date field / calendar to derive quarters.

Can I have any ideas how to proceed with this implementation?

Thanks a lot 🙂 

Labels (2)
15 Replies
qliksus
Specialist II
Specialist II

You can either create new column which has the previous quarter value for each quarter and use that to show the data or have a expression like the below

sum({<Quater={$(=max({<Quater={"<$(=only(Quater))"}>} Quater))}>} Amount)
ckmchinmaya
Contributor III
Contributor III
Author

Yes Sunny. All numbers are from current quarter ( based on user selection ).

sunny_talwar

So, you did create a field like called display_year, right? How exactly did you create it? I mean what was the syntax you used in the script to create it?

ckmchinmaya
Contributor III
Contributor III
Author

Its simply a replace function removes Q and Comma from the year_quarter i.e. 2018, Q1. Post removal of Comma and Q it became a number 20181.

I have used the display year to calculate previous quarter, with the expression I shared earlier. Then I have put that quarter as a set expression to calculate KPIs, then compute Delta.

Though I have managed to get this done via multiple variables in the backend script and able to generate the required outcome. However, performance became a concern. At some point of time  I have to change the way to get the previous quarter KPI values from a resident table only.

sunny_talwar

The reason I say it might be easier to use 

AutoNumber(Year_Quarter) as YearQtrNum,

compared to what you have is that it will be easy to go back one quarter when it is sequential number vs 201704, 201801.... 

ckmchinmaya
Contributor III
Contributor III
Author

Yes Sunny, the method you have suggested it will work for all type of scenarios. I found a lucky escape by simply replace few characters, but your suggested method will be the best.