Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Our May 2021 end-to-end product release from Data Integration to Data Analytics is out! READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
kpradeep5610
Contributor III
Contributor III

Find the employees who's salary got changed in current week compare with previous week

Hi all,

please find the below table pic. (sorry for posting pic instead of table this is for example )

here i have two weeks '202030' and '202031'. i want to compare two weeks employees whose salary got changed in current week(202031). here i have marked as yellow that only one employee salary got changed in '202031' . I want to bring out that employee from the list.

kpradeep5610_0-1600876497602.png

Please experts help me to get the logic for above one.

 

Regards,

Pradeep K

 

1 Solution

Accepted Solutions
tresesco
MVP
MVP

@kpradeep5610 

Just change the function from concat() to count() add remove the additional arguments in it like:

=Count(DISTINCT {<emp={"=Only({<calweek={'$(=Max(calweek))'}>} sal)<> Only({<calweek={'$(=Max(calweek,2))'}>} sal)"}>} emp) 

View solution in original post

9 Replies
Kush
MVP
MVP

@kpradeep5610  what is the expected output?

kpradeep5610
Contributor III
Contributor III
Author

Hi kush,

when i compare two weeks (current week   vs  previous week) employee salaries. whose employee salary got changed in (current week). i want to count those employees . 

example:

kpradeep5610_0-1600923094331.png

here one employee got changed his salary in current week. 

tresesco
MVP
MVP

@kpradeep5610 ,

You can try something like:

=Concat(DISTINCT {<emp={"=Only({<calweek={'$(=Max(calweek))'}>} sal)<> Only({<calweek={'$(=Max(calweek,2))'}>} sal)"}>} emp, ',')

A simpler expression might be there though.

kpradeep5610
Contributor III
Contributor III
Author

Hi,

great work.

it is working, but it gives the EMP code not count(emp's).

which is 51774145, instead of emp code i want count like  '1'

 

tresesco
MVP
MVP

@kpradeep5610 

Just change the function from concat() to count() add remove the additional arguments in it like:

=Count(DISTINCT {<emp={"=Only({<calweek={'$(=Max(calweek))'}>} sal)<> Only({<calweek={'$(=Max(calweek,2))'}>} sal)"}>} emp) 

View solution in original post

kpradeep5610
Contributor III
Contributor III
Author

awesome work , it is working as i expected. but when i change it to my real requirement it wont work. please find the below code

=Count(DISTINCT {<EmployeeCode={"=Only({<Calweek={'$(=max(Calweek))'},TableFlag={'W'},[FLAG.Indicator]={'H','N'},MonthIndicator={'C'}>}AnnualSalary)
<>
Only({<Calweek={'$(vPreviousWeek)'},TableFlag={'W'},[FLAG.Indicator]={'H','N'},MonthIndicator={'C'}>}AnnualSalary)"}>}EmployeeCode)

 

 

im getting some errors

tresesco
MVP
MVP

@kpradeep5610 , In two of your replies you say 'great work', 'awesome work' and your problem is still not resolved. 😋. I know it's your generosity. 

Coming back to your issue. The problem could lie in your variable definition or may be somewhere else that would be hard to tell without investigating your app (at least a sample app). Try accordingly.  

kpradeep5610
Contributor III
Contributor III
Author

@tresesco  you are done a really great work . but problem is what i have provided that is sample data for this your logic is working perfectly ,when i have changed your logic to my requirement it is not working. i think i missed in set expressions.

I'm working in Qlik enterprise, so I'm not able to provide sample app.

I'm very new to Qlik World 

Kush
MVP
MVP

@kpradeep5610  Where you are writing this expression? what are dimensions used ? Can you share some sample to look at?