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: 
musketeers
Creator
Creator

need to find way to show YOY ratio for current and 4 previous years

Hi,

I have data like in below table for a selected country.

Yer_QtrdataGrowth
2011Q2101
2011Q3102
2011Q4103
2012Q1104
2012Q2105
2012Q31061.039216
2012Q41071.038835
2013Q11081.038462
2013Q21091.038095

I have to display the Year_Qtr and Growth in bar chart. I have to calculate Growth field in expression. The logic to calculate growth is:

For the Yer_Qtr 2013Q2= Growth is Data for 2013Q2 / Growth is Data for 2012Q2.

Like that I have to calculate growth for 2013Q2 to 2012Q3.

Is there any way to write one expression which will calculate growth for current year quarter till the last year quarter like we are doing in the above table from 2013Q2 to 2012Q3.

Thanks

2 Replies
Gysbert_Wassenaar

I think the easiest way is to create an AsOf table in the script. That table contains records like this:

AsOfQuarter, Quarter, Type

2013Q2, 2013Q2, Current

2013Q2, 2012Q2, LastYear

2013Q1, 2013Q1, Current

2013Q1, 2012Q1, LastYear

...etc

You can then use AsOfQuarter as dimension in your chart and the expression sum({<Type={'LastYear'}>}data)/sum({<Type={'Current'}>}data).


talk is cheap, supply exceeds demand
musketeers
Creator
Creator
Author

Hi Gysbert,

I have created the table as u have suggested. But the expression you have given will give me always 1 as output because the dimension will be same for condition Type = Last year and Type = Current.

Do we need to write some condition in set modifier for Quarter field also?. I am trying to write the condition for Quarter field in set modifier but I am wrong some where.

What is yoour suggestion.

Thanks

Rajneesh