The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Need help on grouping the records and compare against other groups
I have a dataset with 2 columns PSR,TASK_TYPE. Here PSR is unique numbers. But there are many task types which can be repeated. Now I have applied a group by using aggregate operator. Now I want compare the PSR's among the task types, I don't want same PSR to be in all the task types. I just need that PSR be only in task type but not in all.
For example: If I have got a dataset as mentioned below.
PSR Task_Type
123 new
123 new
123 old
123 process
123 process
456 process
After applying group by result is
PSR Task_Type
123 new
123 old
123 process
456 process
Now I need a logic like if PSR is present in old, new, process flag should show as new record which is trans only. If a PSR is present in only process task_type then flag it as service with the same task_type (process).
End result should be like:
PSR Task_Type Flag
123 new trans
456 process service
0
Best Answer
-
kayman Member Posts: 662 UnicornYou might try with a double aggregation?
First aggregation -> group on PSR and TaskType
Second Aggregation -> group on PSR and count TaskType
If count(TaskType) > 1 then Flag PSR as Trans, otherwise as NotTrans
Now you take this set, join it with your original using PSR as join field and replace the NotTrans Flag with taskType
Bit hard to explain but I hope you get the logic :-)4
Answers