Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Last 4 Quarters

Hi all,

I am displaying a values in a line graph for last 4 Quarters, Using the Below Dimension and Measures

Dimension : if(Last4Quarters = 1, Month(QuarterEnd(CanonicalDate)) & '-' & year(QuarterEnd(CanonicalDate)))

Measure : Count({$<DateType = {invitation}, client_id ={'12','13','15','18','19'}>}invitation_id)

Load Script:

let varRyear   = Num(AddYears(today(),-1));

let varLast4Quarters = num(QuarterEnd(Addmonths(today(),-3)));

let varStartDate  = num(AddYears($(varLast4Quarters),-1));

          

CalendarMaster:

Load *,   

     if (([CanonicalDate] > $(varStartDate)),if(([CanonicalDate] < $(varLast4Quarters)),1)) as [Last4Quarters];

As we are in 4th month it should display mar-2016 in graph but it is not.

quarter.png

Please help where i am doing wrong.

Regards,

Pramod

6 Replies
sunny_talwar

Do you have a sample you can share? The variable settings seems right, not sure what might be missing here

Not applicable
Author

Sorry working on server, don't have any sample data..... any other suggestions to debug

sunny_talwar

I guess first thing to check would be to create a table with CanonicalDate and Last4Quarter as dimensions to see if they line up. Based on your code, you should see 1 for Last4Quarter between the dates 04/01/2015 - 03/30/2016

Is this showing up correctly?

Not applicable
Author

Thanks for the Reply sunny,

It's displaying the Mar-2016 in graph but it's not in order, sorry i dint checked it properly.

sunny_talwar

I did not see that also, my bad

reddy-s
Master II
Master II

Hi Pramod,

So is the issue with the sorting now? If so did you try the custom sort option in the properties panel?