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: 
Anonymous
Not applicable

Set Analysis Expr

Hi,

I have 2 date fields in my datamodel:

1 date field value is having multiple 2nd date field value as shown below:

  

DateField1                         DateField2

24/07/201424/07/2014
24/07/201425/07/2014
24/07/201429/07/2014
24/07/201404/08/2014
25/07/201424/07/2014
25/07/201425/07/2014
25/07/201429/07/2014
25/07/201404/08/2014
29/07/201424/07/2014
29/07/201425/07/2014
29/07/201429/07/2014
29/07/201404/08/2014
04/08/201424/07/2014
04/08/201425/07/2014
04/08/201429/07/2014
04/08/201404/08/2014
11/08/201424/07/2014
11/08/201425/07/2014
11/08/201429/07/2014
11/08/201404/08/2014

Now the requirement is when i use the datefield1 as the dimension  and i need to get the below output for datefield2 in a straight table

Datefield1DateField2
24/07/201424/07/2014
25/07/201425/07/2014
29/07/201429/07/2014
04/08/201404/08/2014
11/08/2014                        null
1 Solution

Accepted Solutions
anbu1984
Master III
Master III

6 Replies
DavidFoster1
Specialist
Specialist

What is the logic you want to use. There seems to be a mix of MIN, MAX and something else for the 11th

anbu1984
Master III
Master III

Check this qvw

rubenmarin

Maybe it's just an if:

If(DateField2=DateField1, DateField2)

I think you can't use set analisys to make that comparison (a different value for each row)

Anonymous
Not applicable
Author

For each datefield1 value- i need the matching datefield2 value,if the matching value is not there then it should be null.

Both the Datefield1 and Datefield2 values should be same if there exists a value for Datefield2,

Anonymous
Not applicable
Author

Thanks anbu.It worked as expected

dferreirogft
Contributor III
Contributor III

@Ruben Marin's Solution will work but I will advise you to modify the script and to create a new column with a flag when the two dateFields are matching:

LOAD *

if(DateField2=DateField1,1,0) as Flag

from [...];

Then you can write your set analysis like

sum({<Flag={1}>}fieldToSum)

This way you will follow Qlikview guidelines and the performance will be better.

Cheers

Dany