Derived Column that is Count of each value

I have a Data Source that i am working with in SSIS.  The data source has an id Column that contains duplicates,  but the way the data is it's actually not a duplicate value.  I know confusing right.

So the data looks like this:
ID         |       Data
20197  |....... more data
20197  |........more data
20197  |........more data
20198  |........more data
20198  |........more data
20199  |........more data

The way the Data is I am needing to  to add a count and grouping. to each values.

The end Result should look like
ID      |Port|    Data
20197  |1|....... more data
20197  |2|........more data
20197  |3|........more data
20198  |1|........more data
20198  |2|........more data
20199  |1|........more data

The data source is CSV so I am needing to do All of this in SSIS some how
BrickwallAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ValentinoVBI ConsultantCommented:
It will require some work such as sorting the data, adding a script component to generate the counter and all, but it is possible.

Have a look at the following article by Jason Strate: http://www.jasonstrate.com/2011/01/31-days-of-ssis-generating-row-numbers-2331/

Especially the RowNumberByEmail is similar to your situation.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AnujSQL Server DBACommented:
Did you tried derived column tool in SSIS?
Jason YousefSr. BI  DeveloperCommented:
Here's also a VB.net similar approach...

@Valentino, did you mean JASON YOUSEF :P

http://asqlb.blogspot.com/2012/04/ssis-rownumber-partioned-by.html
ValentinoVBI ConsultantCommented:
@huslayer: dude, you've got too much spare time! ;)

BTW: you're assuming that the input file contains the data sorted on ID. If that's not the case then an additional Sort transform would be needed.
Jason YousefSr. BI  DeveloperCommented:
Opps I forgot to mention that, thanks for you reminding me !!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.