Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

remove duplicate based on specific value

I have data as shown belew 

 

idstagestatus
1acomplete
1bcomplete
1bnot complete
2acomplete
2bnot complete

 

I want to drop the duplicate rows based on stage and id columns but because they have different status and want to keep the one with "complete".

 

I have seen this measure but I don't know how to compare by stage too and how to make it keep specific value not the MIN

 

measure = 
SUMMARIZE(yourTablename, yourTablename[ID], "MinValue", MIN(yourTablename[status]) )

the result I expect 

 

idstagestatus
1acomplete
1bcomplete
2acomplete
2bnot complete

 

4 Replies

  • camargos88's avatar
    camargos88
    Community Champion

    Hi Anonymous ,

     

    Please, if it worked mark this as a solution. So we can help other with the same question.

     

    Thanks.

     

    Ricardo

    • Anonymous's avatar
      Anonymous
      Not applicable

      thank you it worked but is there any way to apply it with measure

      • camargos88's avatar
        camargos88
        Community Champion

        Hi Anonymous ,

         

        Yes,

         

        try this code:

         

        Measure =
        VAR _qtdeStatus = CALCULATE(DISTINCTCOUNT('Table (2)'[status]); ALLEXCEPT('Table (2)'; 'Table (2)'[id]; 'Table (2)'[stage]))
        RETURN IF(_qtdeStatus > 1; CALCULATE(DISTINCT('Table (2)'[status]); FILTER('Table (2)'; 'Table (2)'[status] = "Complete")); CALCULATE(DISTINCT('Table (2)'[status])))
         
        Ricardo