Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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));



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.


Please help where i am doing wrong.



Tags (1)
6 Replies

Re: Last 4 Quarters

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

Not applicable

Re: Last 4 Quarters

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

Re: Last 4 Quarters

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

Re: Last 4 Quarters

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.

Re: Last 4 Quarters

I did not see that also, my bad

Honored Contributor II

Re: Last 4 Quarters

Hi Pramod,

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

Community Browser