Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis using only

I have an expressioN as follows:

count({$<stopdate={">=$(=only(Date_start))"},startdate={"<=$(=only(Date_stop))"}>}ID)

the problem is if I choose both Date_start and Date_stop for example 2011-03-21 I only recieve the posts that have startdate up to 2011-03-20, i should even get the result there startdate is 2011-03-21 but I don't get that result

Any ideas what can be wrong?



2 Replies
Not applicable
Author

Honestly I've never really fully understood the point of the only function except in some rare cases so I could be wrong here, but I don't understand why you are using only here. It looks like using STOPDATE={">=(=ONLY(DATE_START))"} would be the same as STOPDATE={">=DATE_START"} which I don't think would work anyway for several reasons. Your question is a little vague and I'm not sure I really follow but I think your first problem is that set analysis is calculated once per chart, not once per row. Looking at your post I can't really be sure that you need the set analysis to calculate into a different result for each row but I'm assuming you do unless you actually only want one start date for the entire chart.

Assuming that is your problem you probably need to be something tricky with the aggr function. Something like....

=count(distinct
aggr(
if([STOPDATE]>=[DATE_START] And [STARTDATE]<=[DATE_STOP]
[ID]
)
,[ID],[DATE_START],[DATE_STOP],[STARTDATE], [STOPDATE]
)
)

I didn't realize you had four different dates when I wrote the code above so to be honest I'm not sure if it is going to work or not off the top of my head... but it's probably worth a shot. Again I don't know if I fully understand the question but hopefully something I said was helpful.

Not applicable
Author

I use only- function for choose selected value from both date_stop and date_start