Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Qlik Insider: SaaS capabilities for Data Integration and Analytics, May 25th! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Darren1
Contributor II
Contributor II

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

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

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 II
Contributor II
Author

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