Forum Discussion
undefinedCrew another custom column to count how many times each row value occurs in power query
- 2 years ago
Hi,
Thank you very much for your kind reply.Pardon me for my follow up, but being not so pro , can I seek your help again on how to add your codes into my existing codes.
Should I just add your code after my last step "
#"Added Index" = Table.AddIndexColumn(#"Merged Columns1", "Index", 1, 1, Int64.Type)
- PreviousStepName = <Your existing code here>,
BufferedList = List.Buffer(PreviousStepName[4sector UID]),
AddColumn = Table.AddColumn(PreviousStepName, "Count", each List.Count(List.Select(BufferedList, (l)=> l=[4sector UID])))
Thanks again
- PreviousStepName = <Your existing code here>,
Hi Learner1585 ,
you can do it like so:
PreviousStepName = <Your existing code here>,
BufferedList = List.Buffer(PreviousStepName[4sector UID]),
AddColumn = Table.AddColumn(PreviousStepName, "Count", each List.Count(List.Select(BufferedList, (l)=> l=[4sector UID])))
For performance reasons, you are adding an intermediate step where you buffer the column that you want to search through in each row.
Then you add the column where you count the values that match the current row.
Hi,
Thank you very much for your kind reply.
Pardon me for my follow up, but being not so pro , can I seek your help again on how to add your codes into my existing codes.
Should I just add your code after my last step "
#"Added Index" = Table.AddIndexColumn(#"Merged Columns1", "Index", 1, 1, Int64.Type)
- PreviousStepName = <Your existing code here>,
BufferedList = List.Buffer(PreviousStepName[4sector UID]),
AddColumn = Table.AddColumn(PreviousStepName, "Count", each List.Count(List.Select(BufferedList, (l)=> l=[4sector UID])))
Thanks again