Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count is not matching !

Hi,

Actually I am running this script in SQL server ,

select branch, count(ID)

  FROM XYZ  where (date(Field1)+day(15)) <= GETDATE() group by branch

This is my Qlikview expression :

=Count(If((Date(Field1) + 15) <= DATE(now()),ID)

Both are giving different counts.

Also TODAY() function doesn't gives today's date in Qlikview.

5 Replies
MK_QSL
MVP
MVP

Check for Today(0), Today(1) and Today(2)

antoniotiman
Master III
Master III

As You have Group By in script,

may be you need Aggr(...,branch) and optionally DISTINCT

Regards,

Antonio

Not applicable
Author

I think no need of AGGR() bcoz I am using Branch as a list box.

Today(0), Today(1) and Today(2): Gives same count as before.

sunny_talwar

May be try this

Count(DISTINCT {<Field1 = {"$(='<=' & Date(Today() - 15))"}>} ID)

Where check that =Date(Today() - 15) gives the date you are looking for and in the format of Field1 date field.

UPDATE: Added '<=' & to fix my expression to look at Field1 where is it less than or equal to Today()-15

pipuindia99
Creator III
Creator III

Count(DISTINCT {<Field1 = {"$(=Date(Today() - 15))"}>} ID) what Sunny said looks correct to me as well