Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Leo
Partner - Contributor II
Partner - Contributor II

Climber KPI Issues with Background Trend

 

Hello,

Currently I’m having issues with the Climber  KPI, please see below the object Version:

1.png

This is the QS version we are using at this point:

2.png

I'm  cooking some expressions to have a Climber KPI showing  the count of cases for the Current year, when no year has been selected. The same Climber KPI will Show the Count of the year selected by the user, once the user pick one from the filters.

My problem is that the Climber KPI  Trend is not being showed correctly for the option when no year is selected.

Let’s me start with the case in which is working:

3.png

I obtain this whit the simple expressions:

  • First Measure (Current Year):
    • Count({<CanD_Year={2019}>}DISTINCT[%SRID])
  • Second Measure (Previus Year):
    • Count({<CanD_Year={2019}>}DISTINCT[%SRID])
  • Trend:
    • CanD_MonthYear // Canonical Date Month Year

I also Obtain this behavior when 2019 is selected on the filters and I’m using this Expressions:

  • First Measure (2019 Selected as Current Year):
    • if (Len(getfieldselections(CanD_Year))=4,Count({<CanD_Year = {'$(=getfieldselections(CanD_Year))'}>}Distinct[%SRID]), Count({<CanD_Year={'$(=vYearD)'}>}distinct[%SRID]))
  • Second Measure (Previus year):
    • if (Len(getfieldselections(CanD_Year))=4,Count({<CanD_Year = {'$(=getfieldselections(CanD_Year)-1)'}>}Distinct[%SRID]), Count({<CanD_Year={'$(=vPYear)'}>}distinct[%SRID]))
  • Trend:
    • CanD_MonthYear // Canonical Date Month Year
  • vYearD is a variable that resolve the expression Year(Today) as 2019.
  • vPYear is a variable that resolve the expression Year(Today)-1 as 2018.

 

The problem is when I want to show current versus previous year for the situation in which no selection  using the expressions above:

4.png

 

The logic of the expression is the following:

  • When one year, and only one year, is selected Len(getfieldselections(CanD_Year)) is equal to 4 and the count is based on the year selected, by going the THEN part of the IF statement. For the second measure the count is selected year minus 1.
  • When nothing is selected, or more than a year is selected Len(getfieldselections(CanD_Year)) is not equal to 4 and the count is current year (2019), by going to the ELSE part of the statement. In a similar fashion the second measure will be 2018.

What I’m looking for is that my default state, no year selected looks like the first picture.

I have already tried simplified expressions without getfieldselections or variables. The problem only occurs when evaluating from the IF. In that cases the image of the trends are all compressed to the left.

Can you give me any help on this one?

1 Reply
JordyWegman
Partner - Master
Partner - Master

Hi Leo,

It looks like your formula is only evaluating for 2019, it that correct? What if you put the same calculation in a table? What does the table show you? Make sure you have the same dimensions in your table.

Jordy

Climber

Work smarter, not harder