Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to create a graph with 2 dimensions on the X axis

Hi everybody,

let's say I want to display the year and the month on the X axis of a line graph

I would like to have the years displayed, and the the months displayed above the year

I tried to create this graph, with the 2 dimensions

but only the month dimension is displayed, I can't find the option to display the 2 dimensions

Can someone help me ?

thanks in advance.

9 Replies
johnw
Champion III
Champion III

Unfortunately, I don't think QlikView allows you to have more than one dimension on the X axis. A workaround here would be to create a YearMonth field so that both pieces of information are in a single field. Something like this:

date(monthstart(YourDate),'YYYY MMM') as YearMonth

pover
Partner - Master
Partner - Master

I agree with John and just because I've had a couple stubborn users that insisted on only seeing one Year label you can do something like the following:

if(Month(YourDate)=1,date(monthstart(YourDate),'YYYY MMM',date(makedate(Year,Month),'MMM'))) as YearMonth

Of course, this only looks good if you don't filter months.

Regards.

johnw
Champion III
Champion III


Karl Pover wrote:Of course, this only looks good if you don't filter months.


Couldn't you override the display? Generally I'm against calculated dimensions, but go ahead and create the raw YearMonth field, and then you just need a way to display the year on only the minimum YearMonth for the given year. Hmmmm... OK, this seems to work:

=aggr(date(YearMonth,if(Month=min(total <Year> Month),'YYYY MMM',' MMM')),Year,YearMonth)

See attached.

pover
Partner - Master
Partner - Master

Very nice.

Not applicable
Author

Thank you for your answers,

I have a last question : what is the purpose of the parameters "primary dimension label orientation" and "secondary dimension label orientation" (where we can choose '-', '/' or '|' ) in the Axis tab of a graph properties ?

johnw
Champion III
Champion III

They make the value, such as "2010 Jan" show either horizontally, at an angle, or vertically.

Not applicable
Author

Ok, I understood that, but why "primary" and "secondary" if we have only one level displayed ...

pover
Partner - Master
Partner - Master

If you have just 2 expressions and 2 dimensions you can make the secondary dimension appear. It doesn't look good in the line graph (that's why we didn't mention that above), but it looks decent in a bar graph.

Regards.

Not applicable
Author

OK, i had a try and it actually works with bars

I can't understand the differences with lines but it's like that ...

hope this will evolve in future versions

thanks for all your answers