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: 
cristian_av
Creator III
Creator 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
sunny_talwar
MVP
MVP

May be you need this then

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

View solution in original post

21 Replies
MK_QSL
MVP
MVP

may be

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

sunny_talwar
MVP
MVP

May be this

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

JustinDallas
Specialist III
Specialist III

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.

sunny_talwar
MVP
MVP

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
Creator III
Creator III
Author

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

sunny_talwar
MVP
MVP

Did you try this?

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

MK_QSL
MVP
MVP

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

(Check sunny's reply)

cristian_av
Creator III
Creator III
Author

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

sunny_talwar
MVP
MVP

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....