Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Community,
Facing issue with expression, I have similar data like below
If it is same CODE for EMP (N and Y), they have to calculate sum(SALARY)
trying below expression, but not working..
=IF(AGGR(ONLY({<EMP={'N'}>}CODE), CODE) = AGGR(ONLY({<EMP={'Y'}>}CODE), CODE), SUM(SALARY))
CODE | EMP | SALARY |
A | N | 100 |
A | Y | 200 |
B | N | 300 |
C | N | 400 |
D | N | 500 |
D | Y | 600 |
Output:
CODE | SALARY |
A | 300 |
D | 1100 |
Thanks in advance
Hi @paulwalker ,
You could try with the below expression:
=Sum( if( count( distinct EMP ) = 2, SALARY ) )
with CODE as dimension.
I hope it can helps.
Best Regards
Andrea
try this:
=sum({<CODE=p({<EMP={'Y'}>}CODE)>}SALARY)
which means if there exists a CODE where EMP=Y, sum it
Another one:
SUM({<EMP={'N'}> * <EMP={'Y'}>} SALARY)
- Marcus