Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ALL,
My requirement is below. i need to show 1st Row of team lead as 1 and remaining 0
can i do this in script level?
Team Leader | id | Count1 |
a | 45675465 | 1 |
a | 45675466 | 0 |
a | 45675467 | 0 |
a | 45675468 | 0 |
a | 45675469 | 0 |
a | 45675470 | 0 |
a | 45675471 | 0 |
b | 45675472 | 1 |
b | 45675473 | 0 |
b | 45675474 | 0 |
b | 45675475 | 0 |
b | 45675476 | 0 |
b | 45675477 | 0 |
c | 45675478 | 1 |
c | 45675479 | 0 |
d | 45675480 | 0 |
d | 45675481 | 0 |
Thanks,
Gowtham
How about this:
A:
LOAD * INLINE [
Team,LeaderID
a,45675465
a,45675466
a,45675467
a,45675468
a,45675469
a,45675470
a,45675471
b,45675472
b,45675473
b,45675474
b,45675475
b,45675476
b,45675477
c,45675478
c,45675479
d,45675480
d,45675481
];
B:
LEFT JOIN LOAD
Team,
MIN(LeaderID) AS MinID
RESIDENT A
GROUP BY Team;
C:
LOAD
Team,
LeaderID,
IF(LeaderID=MinID, '1', '0') AS Count
RESIDENT A;
DROP TABLE A;
In load script or front end? Define
"first" - load order or some other sort key?
Something like this, perhaps?
LOAD
[Team Leader],
id,
If([Team Leader] = Previous([Team Leader]), 1, 0) as Count1
Resident .....
Order By [Team Leader], id;
Or use the Above() function in a table in the front end.
If you question has been answered, please mark the correct response or let us know what is the issue.