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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

from set analysis to script during load

Good day everyone,

to convert this syntax from set analysis to script (during load)

=Count({< Active={1},Location={Canada','*Can*'}>}  Distinct EmpNo)-Count({< Terminated={1},Location={'Canada','*Can*'}>}  Distinct EmpNo)



- where Active is record tag as active employee, same goes to Terminated (tag)

- Location is a field

- EmpNo is Employee number


syntax is count Emp No if the employee is active and if location is Canada - count if terminated and location is canada


Regards,




2 Replies
swuehl
MVP
MVP

It's quite hard to convert a chart expression to an aggregation in the script without knowing the context, i.e. your chart expression will still be sensitive to user selections and also consider the dimensional aggregation scope.

The Aggregation Scope

edit:

If all fields are within the same table and you want to calculate in global context (no selections, no dimensions), maybe something like

LOAD

     Count(DISTINCT If(Active=1,EmpNo)) - Count(DISTINCT If(Terminated = 1, EmpNo)) as Result

RESIDENT YourTable

WHERE WildMatch(Location, '*Can*');

Not applicable
Author

Thanks Stefan,

I will try this solution.

Regards,