Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
mithunr40
Contributor III
Contributor III

Set Analysis : Year()

How to calculate the number of employees hired in 2008 (HIRE_DATE). They given me the fields and functions to use in set analysis: EMPLOYEE_ID, HIRE_DATE, year().

I can't use logic in the backend and i just want to show in the front end in expression. 

Please help me to solve this problem.

 

Thank you.

Labels (1)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

If you are going thorugh an assignment/interview, it is also important to ask right questions. In general, the solution I provided earlier - should work, otherwise - you may need to include distinct like:

Count(Distinct {<HIRE_DATE={"=Year(HIRE_DATE)=2018"}>} EMPLOYEE_ID ) 

View solution in original post

10 Replies
MartW
Partner - Specialist
Partner - Specialist

Count({<HIRE_DATE={'=$(=year(makedate(2008,1,1)))'}>} EMPLOYEE_ID )

mithunr40
Contributor III
Contributor III
Author

Thank you for your answer @MartW  but it taking all the date and i think i want only 2008 data only .

 

MartW
Partner - Specialist
Partner - Specialist

that is strange. I tested this with some dummy data and I got only the 2008 ID's back in Qlik.

is it possible for you to share a snippet of the data?

mithunr40
Contributor III
Contributor III
Author

mithunr40_0-1686555800483.png

I am unable to see any data from this sheet it just showing me wrong answer that's it.

tresesco
MVP
MVP

Try like:

Count({<HIRE_DATE={"=Year(HIRE_DATE)=2018"}>} EMPLOYEE_ID )

 

Note: If your date field data is text/string type, it might not work; then you have to convert strings to date type values in script or change the expression a bit using date#()

mithunr40
Contributor III
Contributor III
Author

Thank you for your response @tresesco but here they given me like one page so on that i want to paste the expression i can't see any datamodel or value

Pavanvh
Contributor II
Contributor II

You can use any of the below.

Count({<DATE = {'2008'}>}EMP_ID)

or

Count({<DATE={'$(=year(makedate(2008,1,1)))'}>} EMP_ID )

mithunr40
Contributor III
Contributor III
Author

Hi @Pavanvh it's not working.

tresesco
MVP
MVP

If you are going thorugh an assignment/interview, it is also important to ask right questions. In general, the solution I provided earlier - should work, otherwise - you may need to include distinct like:

Count(Distinct {<HIRE_DATE={"=Year(HIRE_DATE)=2018"}>} EMPLOYEE_ID )