Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

New to set analysis. Why doesn't this work?

I am trying to use set analysis almost for the first time.  I think I'm getting hung up on syntax.

QlikView says the expression is OK, but it is still gives me the sum of cloudAgentSpaceUsedGB instead of limiting the set to the most recent cloudAgentSnapshotDate.  Am I doing something wrong?

sum( {$<cloudAgentSnapshotDate = {"=max(cloudAgentSnapshotDate)"} >} cloudAgentSpaceUsedGB)

Thanks!

-Kevin

1 Solution

Accepted Solutions
JonnyPoole
Employee
Employee

Date comparisons can be tricky.  Try going with a literal (single quotes)  instead of a search  (double quotes)

change:

sum(  {$< = {"=max(cloudAgentSnapshotDate)"} >} cloudAgentSpaceUsedGB)

to:

=sum( {$<cloudAgentSnapshotDate={'$(=Date(max(cloudAgentSnapshotDate)))'}>}   cloudAgentSpaceUsedGB)

View solution in original post

3 Replies
JonnyPoole
Employee
Employee

Date comparisons can be tricky.  Try going with a literal (single quotes)  instead of a search  (double quotes)

change:

sum(  {$< = {"=max(cloudAgentSnapshotDate)"} >} cloudAgentSpaceUsedGB)

to:

=sum( {$<cloudAgentSnapshotDate={'$(=Date(max(cloudAgentSnapshotDate)))'}>}   cloudAgentSpaceUsedGB)

Anonymous
Not applicable
Author

few things to consider:

1. format of the date. max(cloudAgentSnapshotDate) will return numeric value of the date which is being compared to formatted time value, cloudAgentSnapshotDate.

2. Date function with the correct formatting should help. something like - Date(max(cloudAgentSnapshotDate), 'MM/DD/YYYY') - modify the format to your application. if the format is not correct, the sum value will not be what you expect as well.

3. i would set a variable and use it in the set analysis expression. so define a variable vMaxDate as the expression in step 2 and for your sum expression the following:

sum(  {$<cloudAgentSnapshotDate = {"$(=vMaxDate)"} >} cloudAgentSpaceUsedGB)

hope this helps.

Not applicable
Author

Thanks, Jonathan!  It didn't like the Date function, but the single quotes did the trick.  I appreciate your help.