UmaMahesh1
Honored Contributor III

Hi @Adi dev​ ,

Your requirement can be easily achieved by using a dense_rank() function.

As your data looks a bit confusing, creating a sample data on my own and assigning a group id based on KeyName. If you want to assign group id based on other column/s, you can add those to ORDER BY clause accordingly.

Input :

Input 

Output:

Output 

Hope this helps..Cheers.

Uma Mahesh D