Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jdmarlin
Contributor III
Contributor III

Date and Set Analysis

Struggling to understand set analysis and date variables...

[Analysis Date]

09/01/2015

09/02/2015

Document Variable

vMaxDate = Max([Analysis Date])

In a text box =vMaxDate appears as...

42249


This set analysis doesn't work:

Sum({$<[Analysis Date]={$(=vMaxDate)}>} Value)

1 Solution

Accepted Solutions
kavita25
Partner - Specialist
Partner - Specialist

As your date field is MM/DD/YYYY format..

You have make the same format while creating variables and used in Set analysis

Variable:

= date(Max( Date),'MM/DD/YYYY')

Set Analysis:

=Sum({$< Date={'$(=vMaxDate)'}>} Values)

As you are passing the variable in date field in set analysis, its necessary to make the variables in the same format as it is in the date field..

Hope it helps you!!!

View solution in original post

7 Replies
cspencer3
Creator II
Creator II

try

Sum({$<[Analysis Date]={$(=date(vMaxDate,'MM/DD/YYYY')}>} Value)

that might tell you if your date field is being stored as a number or not. I am not certain that will work though...

jdmarlin
Contributor III
Contributor III
Author

I get an 'Allocated memory exceeded' issue with that.

When I do [Analysis Date]={'09/02/2015'}, it works fine though.

cspencer3
Creator II
Creator II

This just worked for me in a test app:

Sum({$<[Analysis Date]={"$(=date(vMaxDate,'MM/DD/YYYY')"}>} Value)

double quotes are added.

However i did not do this with a variable...

jdmarlin
Contributor III
Contributor III
Author

Unfortunately still getting the same error on my end "allocated memory exceeded"

This oddly worked though:

Sum({$<[Analysis Date]={'=Aggr(If(Rank([Analysis Date])=1,[Analysis Date]),[Analysis Date])'}>} Value)

For me set analysis and dates = POISON!

Thanks for your help Charles!

cspencer3
Creator II
Creator II

I hear you there. Dates in Qlik can be very odd.

That has to be the most backwards solution to your problem, but at least it worked! It should be simpler than using AGGR and RANK to get the MAX date!

kavita25
Partner - Specialist
Partner - Specialist

As your date field is MM/DD/YYYY format..

You have make the same format while creating variables and used in Set analysis

Variable:

= date(Max( Date),'MM/DD/YYYY')

Set Analysis:

=Sum({$< Date={'$(=vMaxDate)'}>} Values)

As you are passing the variable in date field in set analysis, its necessary to make the variables in the same format as it is in the date field..

Hope it helps you!!!

MarcoWedel

Hi,

maybe also possible:

QlikCommunity_Thread_179098_Pic5.JPG

QlikCommunity_Thread_179098_Pic1.JPG

QlikCommunity_Thread_179098_Pic2.JPG

QlikCommunity_Thread_179098_Pic3.JPG

QlikCommunity_Thread_179098_Pic4.JPG

QlikCommunity_Thread_179098_Pic6.JPG

hope this helps

regards

Marco