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: 
Darren1
Contributor III
Contributor III

Compare previous year data in KPI

I am working to create a KPI that compares the previous years results to the current selected year.  The user will be able to pick a fiscal year from a filter pane and see the results. However I am having trouble when the first available year is picked (ex 2005) does not have a previous year to compare it to (no data for 2004) . Can the KPI display a text note when a previous year comparison is not available? 

Here is my current expression

Sum({$<fiscal_year={$(=max(fiscal_year))}>} Tons) - Sum({$<fiscal_year={$(=max(fiscal_year)-1)}>} Tons)

1 Solution

Accepted Solutions
rubenmarin
MVP
MVP

Hi, maybe adding a condition to check if the firts year has been selected, something like:

If(max(fiscal_year)=min({1} fiscal_year), 'text note to display', [YourCurrentExpression])

View solution in original post

2 Replies
rubenmarin
MVP
MVP

Hi, maybe adding a condition to check if the firts year has been selected, something like:

If(max(fiscal_year)=min({1} fiscal_year), 'text note to display', [YourCurrentExpression])

Darren1
Contributor III
Contributor III
Author

Thank you for your response. Your expression help did the trick!