Add Unique Serial No in Power Query.

newuser17

New member
Joined
Jun 21, 2018
Messages
6
Reaction score
0
Points
0
Excel Version(s)
2016
Dear Gurus',

I am relatively very new to Power Query.
I run a query to combine excel files from multiple users form a folder. the raw data have same no of columns and same header. the query works like a charm.
But as a new addition to our process we have to serialize the row data based on two conditions with category id and last used serial no. which means each user's file have category ID and related data, which category id is duplicated in a column multiple time. this scenario i same for every user. i m maintaining the category ID and last used serial no in a separate table in another workbook.

now what i need to be done is through the power query is while combining the files add a custom column and serialize the data based on the category id and last used serial no. this can be easily done in normal worksheet max if + 1 formula with iteration calculation enabled. but i have no clue how to include this scenario in the power query.

i have attached few screen shots of my raw data and desired outcome.

raw data

Raw data after combining.jpg

last used serial no
last used serial no.png

desired outcome
Desired outcome.jpg

I have about 10000 of rows to process on daily basis and i would be much grateful for your help, effort and time. i am using excel 2016 in windows 7 environment with no office 365 subscription.

thanks in advance.
 
Alright, so yes, we can make this happen. A couple of things though...

1) I don't believe your sample data/output is correct. (I don't ever say that but...) You've got the last used serial for 1215 as 00789, but in your sample output the first number generated is 000780, not 000790. I only saw this because I calculated your results and it generates two outliers. (Of course, this is why you need Power Query to make sure this doesn't happen to you!) :)
2) This technique actually makes use of two custom columns written using formulas, one of which is a Table.AddColumns(). This is not day 1 stuff for Power Query, but if you want to learn it, we teach you how to get comfortable with these kind of functions in our Power Query Academy.

I've attached the output for you here. Incidentally, the technique I used for this is actually the subject of next week's blog post (which I wrote up a couple of days ago!)
 

Attachments

  • forum.xlsx
    24.7 KB · Views: 21
Thanks

Hi Ken, thanks for your quick reply to my thread, I havent expecting such a early solution for this scenario which I was struggling for weeks.

Yes. I agree that serial no should be 00790. And I admits that its a mistake or human error. To rectify these issues only Im looking for a reliable solution.

At the moment I m home and I dont have excel 2016 at home. Once I reach office I will try the solution and let you know.

Also how can I download the attached file ?
Thank you very much for the power query academy link and I will definitely follow it up.

And I just wonder how I came up with a scenario which is going to be on your next blog..

Thanks anyway..
 
Back
Top