Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Shi
Partner - Contributor III
Partner - Contributor III

Condition Date to see a chart

Hi to eveyone! I have a bar chart with years as dimension and some measures. I would show this chart just for the last six years...than I thought that set a condition in a graph it would be fine. Maybe creating a variable

vYear=Max(Year) - 6

or  vCurrentYear=year(today())

and setting a condition in the chart someting like:

Year>vYear, or  vCurrentYear-6 >Year>vCurrentYear

But these kind of conditions (greater and minus ) seem not work . Do you have any suggestion or maybe another idea to get a chart that shows only last six years? Thanks a lot

Labels (1)
2 Replies
Kushal_Chawda

You can try something like below expression in your chart

Sum({<Year ={">=$(=max(Year)-6)"}>}Sales)

Vegar
MVP
MVP

Using set analysis like @Kushal_Chawda suggested is a good approach. An alternative is to create a custom dimension in your chart replacing your year dimensionnwhit this expression:

=if([Year] > year(today())-6, [Year], Null())

Then make sure to hide null dimension values in your chart.