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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
pablomind
Creator
Creator

Aggregate Function in Script Editor

Hi,

Does any of you please help me writing this code in a Script Level, I know I can do it with Group by but I dont see it clear how to. Any suggestions?

Code:

=SUM(IF(Aggr(Count(DISTINCT [Positions] ) ,[Ee_ID])>1,1,0))

Thank you for your time,

Pablo

1 Solution

Accepted Solutions
sunny_talwar

To complete the whole expression, I think then there is another step where he seem to be summing the 1's

Temp1:

Load Ee_ID,

        If(Count(Distinct (Positions)) > 1, 1, 0) as Aggregate_Position_Field

Resident YourTableName

Group By Ee_ID;

Temp2:

LOAD Sum(Aggregate_Position_Field) as ExpressionResult

Resident Temp1;

View solution in original post

3 Replies
engishfaque
Specialist III
Specialist III

Dear Pablo,

Here is a code,

---------------------

Script

--

Load Ee_ID,

        If(Count(Distinct (Positions)) > 1, 1, 0) as Aggregate_Position_Field

Resident YourTableName

Group By Ee_ID;

Expression

--

Sum(Aggregate_Position_Field)

Kind regards,

Ishfaque Ahmed

Anonymous
Not applicable

try this one

If(Count(Distinct (Positions)) > 1, 1, 0) as Aggregate_Position_Field

sunny_talwar

To complete the whole expression, I think then there is another step where he seem to be summing the 1's

Temp1:

Load Ee_ID,

        If(Count(Distinct (Positions)) > 1, 1, 0) as Aggregate_Position_Field

Resident YourTableName

Group By Ee_ID;

Temp2:

LOAD Sum(Aggregate_Position_Field) as ExpressionResult

Resident Temp1;