How to create index column for each group

I have a table which has consolidated budget from many Excel files. I have a column File Name and I want to create an index column that starts from 2 for each unique File Name - in PowerQuery, I have done this to create a Line Number column to help users to trace this line back to the original Excel file. How do I create a such a column? In PowerQuery, I have just done a group by using File Name and added a running index starting at 2. I asked AI Formula assistant, but what it provided me was not sensible.