Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using Set Analysis Dates along with Another Argument

I have created a pivot table that looks like the following:

Capture.JPG

For the expression for quotes I have

Count({$<QvsI = {"Q"}, OriginalDate={"=CalendarDateKey"}>}QvsI).

What I need is for Quotes to be counting the number of records where QvsI = Q and OriginalDate = CalendarDateKey. The first one meets this criteria. Why would it not be counting it but it is counting PolicyNumberC=5018237? I think I may need to be using the date() function somewhere in the set analysis so that the dates will compare correctly but I'm not sure.

1 Solution

Accepted Solutions
Not applicable
Author

Use the floor function on the integer values for the dates.

like this: date(floor(ResponseDate),'M/D/YYYY') as CalendarDateKey. This will set the CalendarDateKey value to be at midnight of the current day: 8/4/2011 8:16:36 to 8/4/2011 00:00:00.

View solution in original post

11 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi

   Try this

   Count({$<QvsI = {"Q"}, OriginalDate=p(CalendarDateKey)>}QvsI)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

When I change the expression to the above it makes all of the Quotes column zero:

Capture.JPG

Not applicable
Author

Kaushik's response worked for me. Is it possible your dates have un-equal timestamps?

Not applicable
Author

There is no time stamp in the data that is being pulled into the load but I am converting the fields to date format in the load. See the attached test .qvw.

Not applicable
Author

Try adding this as a calculated dimension:

=

date(Responses.ResponseDate, 'MM-dd-yyyy hh:mm:ss')

It looks like your ResponseDate data does have timestamps in it. Formatting the date coming into QV does not eliminate the timestamp, it just obfuscates it.

Not applicable
Author

Ohh. Is there a function that will completely take that off of the ResponseDate so that it will compare correctly?

Not applicable
Author

if(text(OriginalDate)=text(CalendarDateKey), Count({$}QvsI), '0')

Not applicable
Author

Use the floor function on the integer values for the dates.

like this: date(floor(ResponseDate),'M/D/YYYY') as CalendarDateKey. This will set the CalendarDateKey value to be at midnight of the current day: 8/4/2011 8:16:36 to 8/4/2011 00:00:00.

Not applicable
Author

That seems to work. Thank you for all of your timely responses!!