Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

convert SUM expression to Set Analysis

Hi,

I am new to Qlikview and built a prototype for Expression calculation using formula SUM( if(CALC_DATE = vSelectedDate, QTY, 0))

vSelectedDate is a variable of the format 6/10/2015 12:00:00 AM

CALC_DATE is a date with values in the same format.

when I convert the expression to =sum( {<CALC_DATE={$(vSelectedDate)}>} QTY) I get zero.

Am I missing any date conversion in the statement?

How would I use the same logic but only compare the date portion without the time component?

sum(.{<date(CALC_DATE)={date($(vSelectedDate))}>} QTY) produces an expression error.

PS: I am using a Personal Edition version of Qlikview

Thanks much for your help!

3 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

My guess is that vSelectedDate contains a text value and not a date. Possibly CALC_DATE also contains text values and not dates. See this blog post for some pointers: Why don’t my dates work? And this document: QlikView Date fields


talk is cheap, supply exceeds demand
nlmmaurya
Contributor II
Contributor II

Hi,

It seems to be date issue.First convert date in number format,use like this.

Floor(NUM(CALC_DATE)) AS CALC_DATE.

Not applicable
Author

Thank you Gysbert and Neelam. I was able to get to expected result using

=SUM({<CALC_DATE={"=(date(CALC_DATE)=date($(vSelectedDate)))"} >}  QTY)

The Set Analysis document by FABRICE44 on Page 14 notes not to use the dimension when using in the condition statement. Seems to work for me at least for now. I am not sure how I would create a integer key KeyAutoNumber as stated in that document.