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

Counting number of records with date after current date selection

Hi. I am trying to find the number of quotes that started after the current date selection ( I have a calendar set up). The expression I use is Count({<StartTime= {">=$(getFieldSelections(eventDate))"}>} StartTime). I checked that getFieldSelections(eventDate) returns the correct date selections (say 6/4/2020). However, this expression returns 4 instead of 7

shirleyc40_0-1592227277878.png

 

Labels (1)
16 Replies
Saravanan_Desingh

Can you try..?

Count({<StartTime= {">=Date($(getFieldSelections(eventDate)))"}>} StartTime).
shirleyc40
Creator
Creator
Author

@Saravanan_Desingh  It returns 0 😞 

I forgot to put that I use a date picker given by the dashboard bundle to filter the data, if that changes anything

Saravanan_Desingh

Can you also try this once? With single quote around Date.

Count({<StartTime= {">=Date('$(getFieldSelections(eventDate))')"}>} StartTime).

This is Expression in Search. We might need '=' 

Count({<StartTime= {">=Date('$(=getFieldSelections(eventDate))')"}>} StartTime).

 

shirleyc40
Creator
Creator
Author

@Saravanan_Desingh  I put the date inside the $, so Count({<StartTime ={ ">=$(Date(getFieldSelections(eventDate)))"}>} StartTime) and that returned 5, but that is just the number of quotes that started on 6/4/2020 (my image didn't capture it all but there are a total of 5 that start at 6/4/2020. I think it might be the fact that when I pick a date, the data reduces to those that relate to 6/4/2020 and therefore, excluding the ones after 6/4/2020. 

Saravanan_Desingh

I think the Date function should be outside of $-expansion. 

shirleyc40
Creator
Creator
Author

But that returns 0 for me

Saravanan_Desingh

This is working for me.

commQV37.PNG

=Count({<StartTime= {"=Date(StartTime)>=Date('$(=getFieldSelections(eventDate))')"}>} StartTime)
shirleyc40
Creator
Creator
Author

Is it because the table I have that contains the quote number, start and latest come from a bigger table that contains event date? Here is my script

Temp:
LOAD
eventId,
TimeStamp(TimeStamp#(eventDateTime, 'YYYY-MM-DD hh:mm:ss.fff')) as eventDateTime,
Date(floor(TimeStamp#(eventDateTime, 'YYYY-MM-DD hh:mm:ss.fff'))) as eventDate,
eventName,
eventType,
systemId,
environment,
"userId",
userFirstName,
userLastName,
producerTransactionId,
triggerDescription,
quoteNumber,
policyNumber,
ratingReferenceNumber,
agentNumber,
applicationSignedState,
licensingCheckResult,
esignatureStatus,
applicaitonDecision,
if (applicaitonDecision = 'Approved', 1, 0) as Decision
FROM [lib://DataFiles/Mock Data (2).xlsx]
(ooxml, embedded labels, table is Sheet1);


A:
LOAD
Date(Max(eventDate)) as LatestTime,
Date(Min(eventDate)) as StartTime,
quoteNumber,
if (Sum(Decision) = 1, 'Taken', 'Not Taken') as AppDecison
Resident Temp Group By quoteNumber;

Kushal_Chawda

may be try creating variable and use it in set analysis

Create variable on front end as  vMaxDate  and put below expression

= date(max(eventDate))

Now you can use your actual expression as below

Count({<StartTime= {">=$(vMaxDate)"}>} StartTime)