Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
gautik92
Specialist III
Specialist III

Variable

I want to create variable for yesterday and i want to count no of employees present yesterday using that variable

1 Solution

Accepted Solutions
Kushal_Chawda

Create variable in front end

vYesterday = date(max(YourDateField)-1,'YourDateFormat')

Now use below expression to count the employees

=Count({<YourDateField= {'$(=vYesterday)'}>} EmpID)


Without variable you can use below expression


=Count({<YourDateField= {'$(=date(max(YourDateField)-1))'}>} EmpID)



View solution in original post

11 Replies
qlikmsg4u
Specialist
Specialist

Use this to create Yesterday variable

Let vYesterday = Date(Today()-1)

TO count no of employees use this

=Count({<YourDateField = {'$(vYesterday)'}>} Distinct EmpID)

gautik92
Specialist III
Specialist III
Author

that is ok  but how can use variable in count expr

I want to find no of employees present yesterday

qlikmsg4u
Specialist
Specialist

=Count({<YourDateField = {'$(vYesterday)'}>} Distinct EmpID)

tresesco
MVP
MVP

vYesterDay = Date(Today()-1)

Count(Distinct {<Date={'$(vYesterDay)'}>} Employees)

Peter_Cammaert
Partner - Champion III
Partner - Champion III

To supply you with a ready-to-use expression, we need to know more about the table in which you keep employee presence information.

You can use this as an example (set analysis):

=Count({<RecordDate = {"$(vYesterday)"}>} DISTINCT EmployeeID)

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Shouldn't distinct go after the set analysis spec?

maxgro
MVP
MVP

expression

count({$ <Date={'$(vYesterday)'}>} IdEmployee)

variable vYesterday

=date(today()-1)

or

=(today()-1)

Kushal_Chawda

Create variable in front end

vYesterday = date(max(YourDateField)-1,'YourDateFormat')

Now use below expression to count the employees

=Count({<YourDateField= {'$(=vYesterday)'}>} EmpID)


Without variable you can use below expression


=Count({<YourDateField= {'$(=date(max(YourDateField)-1))'}>} EmpID)



tresesco
MVP
MVP

Hi Peter,

It actually works both ways.