Qlik Community

Qlik Sense App Development

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

fasuhaibani
New Contributor III

KPI Expression Doesn't Work Anymore?

Hello Everyone!

So we have been working with Qlik Sense for a while now, and when we started to used to have the following expression in a KPI chart:

Count({<[ItemExpiryDate] = {"$(='<' & Date(Today()))"}>} distinct ItemID)

When we did a reload last week the value of the KPI chart is always equal to ZERO. We have checked the data and everything seems fine; however, I'd like to figure out why is Qlik Sense giving us this result. .

Your help is really appreciated,

13 Replies
lironbaram
Honored Contributor II

Re: KPI Expression Doesn't Work Anymore?

hi

check in what format the field ItemExpiryDate

it's important that the date format in the set analysis will be similar to the one of the field ItemExpiryDate

fasuhaibani
New Contributor III

Re: KPI Expression Doesn't Work Anymore?

Thanks for your reply. I believe nothing has changed since we first implemented this expression. Also when we re-wrote the expression as an IF Condition it worked like a charm.

Thanks!

vinieme12
Esteemed Contributor II

Re: KPI Expression Doesn't Work Anymore?

The operator should be outside


Count({<[ItemExpiryDate] = {"<=$(=Date(Today()))"}>} distinct ItemID)

fasuhaibani
New Contributor III

Re: KPI Expression Doesn't Work Anymore?

Thanks Vineeth! However, the expression doesn't work. it gives the total of items. In other words, it ignores the condition.

vinieme12
Esteemed Contributor II

Re: KPI Expression Doesn't Work Anymore?

what format is ItemExpiryDate? 

if it is DD/MM/YYYY format then you need to add it to the expression as below

Both comparing field and value have to be in same format.

Count({<[ItemExpiryDate] = {"<=$(=Date(Today(),'DD/MM/YYYY'))"}>} distinct ItemID)

fasuhaibani
New Contributor III

Re: KPI Expression Doesn't Work Anymore?

The format is the default, as it has not been changed. As I mentioned before, it was working fine and even when we re-wrote it as an IF condition (without specifying the format). It works find. Also I have tried specifying the format and the result now is  "-" instead of a ZERO.

vinieme12
Esteemed Contributor II

Re: KPI Expression Doesn't Work Anymore?

What is your Default Format?

try this

Count({<[ItemExpiryDate] = {'<=$(Date(Today()))'}>} distinct ItemID)

or

Count({<[ItemExpiryDate] = {"<=$(Date(Today()))"}>} distinct ItemID)

fasuhaibani
New Contributor III

Re: KPI Expression Doesn't Work Anymore?

SET DateFormat='M/D/YYYY';

I have tried both expressions and it gives the total (ignores the condition)

vinieme12
Esteemed Contributor II

Re: KPI Expression Doesn't Work Anymore?

and the Format for [ItemExpiryDate]  is it the same?