# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor III

## Re: Year comparison in bar chart

It is an extension.  Ok, I will try by other way. And in these formulas we compare the period, how can we compare the years regarding the max(Date) information ? how the period could be changed by the max(Date) ??

I try to change the period(in all measures) by this {"=max(date)"}.  Will it work properly ?

MVP

## Re: Year comparison in bar chart

I guess replace all Today() with Max(date) and it should work....

New Contributor III

## Re: Year comparison in bar chart

=Sum({\$<Year,Date = {">=\$(=YearStart(Max(date)))<=\$(=MonthEnd(Max(date)))"}>} FactSoldAmount)

=Sum({\$<Year, Date = {">=\$(=YearStart(AddYears(Max(date), -1)))<=\$(=MonthEnd(AddYears(Max(date), -1)))"}, BranchID = p({<Year = {"\$(=Max(Year))"}>})>} FactSoldAmount)

Thank you very much, it works. but now I have another problem. it shows only the year and last year that I select. I want to show all the year

MVP

## Re: Year comparison in bar chart

All years? I have no idea what you mean... you will have to assume that I don't know anything...

New Contributor III

## Re: Year comparison in bar chart

Sorry, I don't explain well and sorry to bothering you. I mean When I select 2018 it shows me 2016,2017 and 2018 years' compare in the bar chart. When I select 2017 it shows me only 2016 and 2017 (I want to show 2018too) I had the same problem up in this discussion and you helped me that's why I asked. Sorry again and thanks a lot for your help in everything in these days

Highlighted
MVP

## Re: Year comparison in bar chart

Oh, that might be because we have coded to look back in time....

1) expression is for max year

2) expression is for max year -1

3) expression for for max year - 2

when you select 2017, it will show 2017, 2016 and 2015 (assuming you have data for all these three years)