Thank you for the reply Neelima. Sorry for the delay in responding back to you. Your solution will definitely give me the count but does not remove the duplicates. As it turns out, the duplicate problem was due to issues with the data itself. I was verifying that and that's why it took me awhile to respond.
Sorry for the delay in replying. As it turns out, there's a problem with the data itself that's causing the duplicates. Your solution did remove some of the duplicate lines (where ParentLineItemId is null) and I suspect if not for the data issues, your solution would remove any others. Thanks for your reply and I'll be marking your answer as the correct answer. Thanks again.