Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Year Comparison

Hi There,

I am trying to do this, I have an bar graph with total count of something, distributed by year.

So, I Want to, when I click in 2015 another graph shows me the total count of the 2014 year, when a click in 2016 this graphs shows me the 2015 year, so goes on...

Does anyone knows how to do this?

Thanks in advice,

Rodrigo Peixoto.

13 Replies
MVP & Luminary
MVP & Luminary

Re: Year Comparison

If you select only one year then you can adapt the expression in the target chart to show the count of the previous year. Suppose that chart now has an expression like count(Orders) you can change that to count({<Year={$(=max(Year)-1)}>}Orders). This assumes that your year field has the name Year. Make sure to use the correct case sensitive field names of your document.


talk is cheap, supply exceeds demand
Highlighted
Partner
Partner

Re: Year Comparison

Try this

SUM({$<Year={$(=Max(Year)-1)}>} SalesAmount)

Re: Year Comparison

You should be able to use The As-Of Table conecpt here : The As-Of Table

Not applicable

Re: Year Comparison

All of this formulas gave me the 0 result.

I am thinking that te as-of table concept will be the only way to do this.

Re: Year Comparison

The other options will work, but we won't know the exact scenario of what you are doing, would you be able to share a sample to look at and propose a working expression?

Not applicable

Re: Year Comparison

I've started a new app and make this formulas and worked, but in my first app it can't be done.

In my original app, I've made a join with a kml, can this be the cause of the problem?

Not applicable

Re: Year Comparison

I've found my problem.

I was using the formula =year(date)  to get the year, but I also have the fiel "Year" in my table. Using the field Year, I could get the information, but by year(date) no. There is a way to do with the formula "=year(date)"?

Re: Year Comparison

Where were you using Year(Date) in the expression?

Not applicable

Re: Year Comparison

I have one drill-down graph, where I use the formula =year(date) and =month(date) to make the field.

So, in this drill-down graph, if I choose one year, the other graph with this formula (SUM({$<Year={$(=Max(Year)-1)}>} SalesAmount) , nothings happens, but, if I make one bar graph use the field year (instead of getting the year by the formula =year(date)) its works fine.

Anyway to solve this problem?