Combine only unique values in a query

Alexandra Groza 21 Reputation points
2020-11-16T11:54:59.957+00:00

Hi,
I have a pretty large inventory table which is combined from multiple similar sources by user names used as unique key, but i have the following situation
User A - laptop laptop monitor
User B - monitor monitor monitor
User C - desktop desktop desktop laptop

I couldn't find any way of removing duplicates after i merged the table so i could have something like this:
User A - laptop monitor
User B - monitor
User C - desktop laptop

Can it be made directly in Powerquery or i have to work on the table imported in Excel with VB functions?

Thank you

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
38,772 questions
{count} votes

Accepted answer
  1. Lz._ 9,006 Reputation points
    2020-11-16T13:32:39.377+00:00

    @Alexandra Groza

    Don't get me wrong but it takes less than 5 mins to create a table with dummy data in Excel. I had to do it and I hope it reflects what you have at step #"Replace Value4":

    40074-demo.png

    If the above picture reflects your reality:

        #"Grouped Rows" = Table.Group(#"Replaced Value4", {"UserName"},  
            {  
                "ComputerNow", each  
                    Text.Combine(  
                        List.Distinct([#"Computer@Home"],Comparer.OrdinalIgnoreCase),  
                        " - "  
                    ),  
                type text  
            }  
        )  
    

    If this still not good please create a table with dummy data and upload it (a pic. should be enough).
    On the other end if this solves your problem please mark this reply as answer to help others with a similar case - Thanks in advance


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.