Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

cristian_av
Contributor III

Best before by...

Hi

I need to separate product based on their expiration date. I have two fields called:

- "Max Time":  Products dimension, has the number of days that a product is still in good quality

- "Item Time":  Has the number of days since the product has been manufactured, from today.

I want to create an expression with set expression, to count all the products that are out-dated. I was trying with something like this, but is not working:

=Sum({<ItemTime={">$(=MaxTime)"}>}#Box)

How should I do this?

Thanks!!

1 Solution

Accepted Solutions
MVP
MVP

Re: Best before by...

May be you need this then

=Sum({<BoxIDField = {"=ItemTime > MaxTime"}>} #Box)

21 Replies

Re: Best before by...

may be

=Sum({<ItemTime={"=ItemTime >= MaxTime"}>}#Box)

MVP
MVP

Re: Best before by...

May be this

=Sum({<Product = {"=ItemTime > MaxTime"}>} #Box)

drillnaut
Valued Contributor

Re: Best before by...

Hello Sunny,

I'm not the OP but I'm confused about the comparison between the Product and ItemTime.  How should I interpret that?  Just trying to gain more strength on complex set-analysis issues.

MVP
MVP

Re: Best before by...

This might help clarify what I was trying to suggest (but apparently it might not have worked in this case )

Re: Why i am not getting same result with Above function ?

cristian_av
Contributor III

Re: Best before by...

It works.. But only if I have an element selected in the products field. Any idea about why?

MVP
MVP

Re: Best before by...

Did you try this?

=Sum({<Product = {"=ItemTime > MaxTime"}>} #Box)

Re: Best before by...

Use Product in set modifier, which must be primary field for your product table.

(Check sunny's reply)

cristian_av
Contributor III

Re: Best before by...

Didn't work! I get just zero values with the expression

MVP
MVP

Re: Best before by...

You do have a dimension called Product, right ... might sound dumb... but a lot of the times people just copy paste the expression without replacing the fields... you have to use the product field for Product in the expression I provided....