Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
frescopozzo
Contributor
Contributor

Show count in straight table

I have this load script

MyTable:
LOAD * INLINE [
Ename,Egender,Dept
John,M,10
Hank,N,10
Jill,F,20
Frank,M,20
Joan,F,20
Chris,M,30
];

 

This results in this straight table 

Ename Egender  Dept
Chris     M               30
Frank    M                20
Hank     M               10
Jill          F                20
Joan      F                20
John     M               10

I would like an extra column emp_count_in_dept_with_current_selection with the number of employees in each department  in the current selection of my data so

the desired result would be

Ename Egender  Dept  emp_count_in_dept_with_current_selection
Chris     M                30       1
Frank    M                20      3
Hank     M               10      2
Jill          F                20      3
Joan      F                20      3
Anna     F               10       2

And when I select F in the straight table I want

Ename Egender  Dept  emp_count_in_dept
Jill          F                20      2
Joan      F                20      2
Anna     F               10       1

 

Labels (2)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

Count( total <Dept> Ename)

View solution in original post

2 Replies
tresesco
MVP
MVP

Count( total <Dept> Ename)

frescopozzo
Contributor
Contributor
Author

Thank you very much!