Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
Contributor II

bar chart last four year data

Hi I am trying to display last four year sales in bar chart.What is wrong with the expression. Please guide

Sum({$<Year = {'<=$(=Max(Year )) >=$(=Max(Year )-3) '}>} sales)

1 Solution

Accepted Solutions
Highlighted
Partner
Partner

Re: bar chart last four year data

maybe this:

=Sum( {< Year = {"<=$(=Max(Year))>=$(=Max(Year)-3)"} >} sales )

View solution in original post

4 Replies
Highlighted
Partner
Partner

Re: bar chart last four year data

maybe this:

=Sum( {< Year = {"<=$(=Max(Year))>=$(=Max(Year)-3)"} >} sales )

View solution in original post

Highlighted
Partner
Partner

Re: bar chart last four year data

in a set expression, if we wanna work with the year 2016 for example which is numeric: we call it without quotes:

Year={2016}

If we wanna focus on a country, Tunisia for example which is a string: we call it with quotes

Country={'Tunisia'}

In our case, we focusing on a range of dates created by an expression, so we surround it by double quotes:

Sum( {< Year = {"<=$(=Max(Year))>=$(=Max(Year)-3)"} >} sales )


Highlighted
Honored Contributor

Re: bar chart last four year data

Try with double quotes, then your string will be evaluated.

Partner
Partner

Re: bar chart last four year data

Hi Avneet,

Try below,

=Sum({<Year={">=$(=yearstart(Max(Year),-3)) <=$(=Date(Max(Year)))"}>} Sales )