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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
AmitSaini
Helper I
Helper I

Need to build new table who have unique filtered data rows only from existing table

Hi Community Members,

Need your help to build new table from the existing table. below is the table look like.

AmitSaini_0-1736418360556.png

As you seen in the above table, we have some duplicate id's with different status and auto_status.

I want to create new table using the above table , if we have any duplicate id then we consider only id who have the status= Yes and Auto_Status = Candidate for Automation only.

Taking example for 1st id - 1047452, need to keep only second row only because who have the status= Yes and Auto_Status = Candidate for Automation, first row should remove. 

And my result table or final table look like below:- 

AmitSaini_1-1736418685661.png

 

Please help me to achieve this in Power query or Dax.

 

Thanks

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

Thanks for bhanu_gautam's concern about this issue.

 
Hi, @AmitSaini 

I am glad to help you.

 

Perhaps you could try using the following DAX:

NewTable = 
UNION (
    FILTER (
        ExistingTable,
        ExistingTable[status] = "Yes" && ExistingTable[Auto_Status] = "Candidate for Automation"
    ),
    FILTER (
        ExistingTable,
        COUNTROWS (
            FILTER (
                ExistingTable,
                ExistingTable[ID] = EARLIER(ExistingTable[ID])
            )
        ) = 1
    )
)

 

Output:

vfenlingmsft_0-1736477455591.png

 

I have attached the pbix file for this example below, I hope it helps!

 

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-fenling-msft
Community Support
Community Support

Thanks for bhanu_gautam's concern about this issue.

 
Hi, @AmitSaini 

I am glad to help you.

 

Perhaps you could try using the following DAX:

NewTable = 
UNION (
    FILTER (
        ExistingTable,
        ExistingTable[status] = "Yes" && ExistingTable[Auto_Status] = "Candidate for Automation"
    ),
    FILTER (
        ExistingTable,
        COUNTROWS (
            FILTER (
                ExistingTable,
                ExistingTable[ID] = EARLIER(ExistingTable[ID])
            )
        ) = 1
    )
)

 

Output:

vfenlingmsft_0-1736477455591.png

 

I have attached the pbix file for this example below, I hope it helps!

 

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-fenling-msft 

I appreciate the solution. It’s working perfectly.

It would be very helpful if you could provide the same solution in Power Query. This way, I can add only the final output table to my data model, rather than including the original table.

bhanu_gautam
Super User
Super User

@AmitSaini , Create a new table using DAX

NewTable =
FILTER (
ExistingTable,
ExistingTable[status] = "Yes" && ExistingTable[Auto_Status] = "Candidate for Automation"
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






hi @bhanu_gautam 

Thanks for your reply.

But it won't work. The dax table you suggested it gives us only the id who have status] = "Yes" and [Auto_Status] = "Candidate for Automation" and exclude others rows who have unique rows entry.

for e.g. id 1188065,1188055 and all rows from project Kodiak.

Please see my Expected table output screenshot. I need unique rows entry as well.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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