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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
yuzexi
New Member

Creat a new column to delete duplicate row based on multiple condition

Hello,

 

We need help to create a dax formule.

We have a calculated table which have the following columns (Training, Email,  Date, Statut, Source) 

For one person, he could do the training in serveral applications (LWL, CHINA, PROOFPOINT). But the key of this table should be Training and Email. Based on the data from the different source (LWL, CHINA ou PROOFPOINT) and Statut (DONE, NOT DONE) we delete the row.

So the aim is to create a new column to decide which row should be deleted (the value of this field will be "DELETED" ou "KEPT")

 
if the source is "LWL" and Statut is "NOT DONE " while another row has the source as "CHINA" and Statut as "DONE", in this case, the one has "LWL APP" and "NOT DONE" should be deleted for the same email and training.
If the source is "LWL APP" and Statut is "DONE" while  another row with the source as "CHINA" and Statut as "DONE", then the one which has "CHINA" and Statut as "DONE" should be deleted.
 
And in this table, there is already a calculated column CheckDuplicateData to know the rows which have the duplicated rows based on eamil and trainingid.
 
Thank you very much,
regards,
Zexi
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @yuzexi ,

I have created a simiple sample, please refer to it to see if it helps you.

Create a measure.

Measure =
IF (
    MAX ( 'Table'[statut] ) = "NOT DONE"
        && MAX ( 'Table'[cource] ) = "LWLAPP",
    "DELETE",
    IF (
        MAX ( 'Table'[statut] ) = "DONE"
            && MAX ( 'Table'[cource] ) = "CHINA",
        "DELETE",
        "KEPT"
    )
)

vpollymsft_0-1666336695764.png

 

 

If I have misunderstood your meaning, please provide more details with your desired output and pbix file without privacy information.

 

Best Regards

Community Support Team _ Polly

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @yuzexi ,

I have created a simiple sample, please refer to it to see if it helps you.

Create a measure.

Measure =
IF (
    MAX ( 'Table'[statut] ) = "NOT DONE"
        && MAX ( 'Table'[cource] ) = "LWLAPP",
    "DELETE",
    IF (
        MAX ( 'Table'[statut] ) = "DONE"
            && MAX ( 'Table'[cource] ) = "CHINA",
        "DELETE",
        "KEPT"
    )
)

vpollymsft_0-1666336695764.png

 

 

If I have misunderstood your meaning, please provide more details with your desired output and pbix file without privacy information.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello,

 

Thank you very much for your proposal.

Howerver it seems not the resultat which I am waiting for. I added your formule in the measure _M_SOURCE_DELEE. for the sessionID 764, it is correct.  CHINA should be deleted and LWL APP should be kept. But for the sessionID 233,  LWL APP should be deleted and CHINA should be kept as it is "LWL APP" who is not done (M_DONE_OU_PAS).

yuzexi_0-1666794255851.png

Thanks a lot for your help,

 

regards,

Zexi

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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