Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
ZoeM
Specialist
Specialist

Show Data points only for future years

Community,

Happy Holiday Season.

I have a combo line/bar chart with Year as the x-axis range. I have dates ranging from 2012 through 2022.

I have 3 data points, Actual, Plan, and Forecast. For the forecast data point, I want it to show only for future years, as it does not make sense to have forecast for past years. 

I tried using the following conditional expression under expressions:

If(IsNull( GetFieldSelections(Year)),Year>Today()) ,

meaning if there is no year selected only show data points for future years greater than today. The forecast value is simply 1 or 100%. 

Thanks for your ever valuable help!

1 Solution

Accepted Solutions
sunny_talwar

set analysis for forecast expression should do the job for you... give it a try... or you can use if statement for forecast expression

If(Year > Year(Today()), ForecastExpression)

View solution in original post

5 Replies
Gysbert_Wassenaar

Perhaps something like sum({<Year={">$(=Year(Today()))"}>}Forecast)

talk is cheap, supply exceeds demand
sunny_talwar

Do you use Year as a dimension? If you do... then may be you can use this as a calculated dimension

If(Year > Year(Today()), Year)

or you can use set analysis in your expression

Sum({<Year = {"$(='>' & Year(Today())"}>} Measure)
ZoeM
Specialist
Specialist
Author

Chart.JPG

Above is my chart. As you can see, the "Forecast" amounts are showing through the entire range of years. The expression for Forecast is simply, =1, because it is 100%. I'm not sure if I can use Set Analysis as the expression, and I am using Year as my dimension. I do not think I can use a calculated dimension because I need all the years to show the trend...

sunny_talwar

set analysis for forecast expression should do the job for you... give it a try... or you can use if statement for forecast expression

If(Year > Year(Today()), ForecastExpression)

ZoeM
Specialist
Specialist
Author

I used the If statement:

If(Year>Year(Today()),1,'')

Works as a charm and thansk a ton Sunny!