Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
danialier
Creator III
Creator III

How to fix X axis in a Chart

Hello,

I have a combo chart showing all quarters in the x axis. I want this to be fixed and showing the last 8 quarters whatever period I select.

How i can do that ?

Thanks,

dani

4 Replies
paulcalvet
Partner - Specialist
Partner - Specialist

Hi Dani,


You can use this command in your expression:


Sum( {< Quarter= {"<= $(=Max(Quarter))"} >} Sales)



And you add a limit to the dimension quarter.


Paul

vipin_mishra479
Creator II
Creator II

Hi

use this one

sum({1}Amount)

in expression

sudeepkm
Specialist III
Specialist III

Assume that your date field name is "Period".

Then you can use a script to create a QuarterNum field in the data load script.

It is always useful to create the numeric format of the time periods.

Ceil(month(Period)/3) + if(year(Period)=Year(Today()),4,0) as QuarterNum,

Suppose you Quarter field is like : QtrYear (in format like Q2-2012, Q1-2013,Q2-2013 etc)

You can use that field as dimension and now in your chart expression you can use like below.

sum({<QuarterNum={">=$(=max(QuarterNum)-1)<=$(=max(QuarterNum))"} >} Amount) which will result in showing the last two quarters.

But I think what you are looking for is not completely here. The above solution will show data based on the Quarter selected. Because I think when we use functions like max or min they are relative to the current selection. So the quarter you selected becomes the max quarter unless you keep a separate variable at load script level to store the max value of the Quarter in your data. Then that variable can be used.

kiranmanoharrode
Creator III
Creator III

HI Dani,

     1st of all derive Quarter from Date field. Then add calculated Dimension in your chart,

=if(ceil(Month(Today())/3)<='8',YourQuarterField)

and Bypassall Selections in expression with help of Set analysis 

Regards
Kiran Rode

+91 897 6977 897