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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
New-Qlik
Creator III
Creator III

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
agigliotti
MVP
MVP

maybe this:

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

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it

View solution in original post

4 Replies
agigliotti
MVP
MVP

maybe this:

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

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
OmarBenSalem
Partner - Champion II
Partner - Champion II

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 )


shiveshsingh
Master
Master

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

Anonymous
Not applicable

Hi Avneet,

Try below,

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