Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
nisha_rai
Creator II
Creator II

Compare current and Previous quarter

Hi,

I am trying to calculate the current and previous quarter comparison.

I have Quarter and Year field in data . how to find the Previous Quarter?

Eg:

Year Quarte Name,Sales

2016,Q4,ABC,200

2016,Q3,XYZ,500

2016,Q4,QWE,600

2017,Q1,PQR,700

For Current Quarte I am usingg the below Formula;

VRepoYear =max(Year)

VRepoQtr = Maxstring(Quarter)

   

sum({<Year={$(=$(VRepoYear))},Quarter={$(=$(VRepoQtr))}>}Sales)

Please help me to find the Previous Quarter .Based on the selection your Quarter and year will be change.

Thanks

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Ideally you should create a date field in the model. However, you can try like showed in attached qvw.

View solution in original post

9 Replies
hemanthaanichet
Creator III
Creator III

Hi ,

I tried with my sample data may be it will help u i think

nisha_rai
Creator II
Creator II
Author

Hi ,

in your data you have Date field, but we don't have date field, we have Quarter and Year based on that we have calculate the Current and previous comparison.

tresesco
MVP
MVP

Ideally you should create a date field in the model. However, you can try like showed in attached qvw.

hemanthaanichet
Creator III
Creator III

Try to create a date which represents your quarter then it will workout i

think

nisha_rai
Creator II
Creator II
Author

For creating date we need month, but in our data we don't have month field, can you please help me how to create date with the help of quarter and year

tresesco
MVP
MVP

Did you check the solution I proposed in the attached qvw above?  Using Quarter and Year field you can create date like:

Load

         MakeDate(Year, Right(Quarter,1)*3) as Date

          Right(Quarter,1) as QtrNum,

          Quarter,

          Year

From <>;

nisha_rai
Creator II
Creator II
Author

Thanks For you help

nisha_rai
Creator II
Creator II
Author

with the hepl of date i am not getting correct resuly, but the above qvw helps to get the correct result

vikasmahajan

Hi Tresesco,

 

can i Use same approach here for my issue ?

Prior Quarters & month growth% calculation in pivo... - Qlik Community - 1984501

 

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.