Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
alec1982
Specialist II
Specialist II

Variable for Table fields in a table chart

Hi Guys,

I have a table chart that shows as follow:

Location     2013     2014     2015     Sales

.......          ....          ...          ..          ...

.......          ...           ..          ..          ...

Is there anyway I can make the fields variables like

Dimenssion one= Location

Dimenssion two = Year(Today())

Dimenssion three=Year(Today())+1

Dimenssion  Four =Year(Today())+2

Expression = Sum(Sales)

so next year i dont need to change anything on the chart and will delete 2013 by itself and add the new years

I tried to put it in the dimenssion as it Year(Today()) but it gave me error

Thxs,

Alec

3 Replies
nagaiank
Specialist III
Specialist III

Try to save the data in a table with three fields (Location, Year and Sales)

In the bar chart use the calculated dimension

=If([Year] >= Year(Today()) or [Year] <= Year(Today())+2,[Year],Null())

Also check 'Suppress When Value is Null' for the dimension

Hope this helps.

alec1982
Specialist II
Specialist II
Author

This is perfect, however I added couple of years just as a sample, what if we have more then 3 years in total, how can I get the dimenssion to show up to max year?

Thxs for all your help!

Alec

nagaiank
Specialist III
Specialist III

You may control the years to display using the calculated dimension. As an example, if you want to display three year of data ending with the max(year), your calculated dimension expression will be

=If(Year >= $(=Max(Year))-2, Year, Null())