Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Create new table based on duplicates in a colum

Hi All,  I am fairly new to Power BI and I am having a hard time trying to do something i thought would be very easy.  I have a table that contains sales information.  Each row is a different line from an invoice generated from our system.  If the invoice we generated had multiple products on it, it will list each product on its own row and use the same invoice number.  So under my invoice number column, I will have duplicates.

 

What I am trying to do is create a new table that only has the sales of invoices with multiple products.  So in essense,  I want to be able to identify duplicate invoice numbers in a column and put that in a separate table. 

 

Any help would be appreciated.  Also, I am new to this forum so if this is not the correct place to post this please let me know. 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @Anonymous,

 

I'd like a part of sample data to help us clear your data structure for coding formula.

 

Sample:

New Table =
VAR _list =
    DISTINCT (
        SELECTCOLUMNS (
            FILTER (
                SUMMARIZE (
                    Table,
                    [invoice ID],
                    "Product Count", COUNTROWS ( VALUES ( Table[Product] ) )
                ),
                [Product Count] > 1
            ),
            "ID", [invoice ID]
        )
    )
RETURN
    FILTER ( Table, [invoice ID] IN _list )

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

HI @Anonymous,

 

I'd like a part of sample data to help us clear your data structure for coding formula.

 

Sample:

New Table =
VAR _list =
    DISTINCT (
        SELECTCOLUMNS (
            FILTER (
                SUMMARIZE (
                    Table,
                    [invoice ID],
                    "Product Count", COUNTROWS ( VALUES ( Table[Product] ) )
                ),
                [Product Count] > 1
            ),
            "ID", [invoice ID]
        )
    )
RETURN
    FILTER ( Table, [invoice ID] IN _list )

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.