Announcements
Applications are open for the 2024 Qlik Luminary Program. Apply by December 15 here.
cancel
Showing results for
Did you mean:
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.

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

Regards,

1 Solution

Accepted Solutions
MVP

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)

10 Replies

@kpradeep5610  what is the expected output?

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:

here one employee got changed his salary in current week.

MVP

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.

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'

MVP

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)

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

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.

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

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

Tags
Community Browser