Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago

"Remove Duplicate" doesn't remove all duplicate

Dear all,

 

I have a table with just one column, I tried to remove the duplicate in the column via power query. However, once I loaded to the dashboard I use count and count(distinct) both give me different number as the same number is expected.

 

 

Best regards,

Eric

15 Replies

    • ImkeF's avatar
      ImkeF
      Icon for Community Champion rankCommunity Champion

      Well, if your table just consists of one column, you can actually use this formula:

       

      Table.ExpandListColumn(#table({"ColumnName"}, {{List.Distinct(Source[ColumnName], Comparer.OrdinalIgnoreCase)}}), "ColumnName")

       

      It's a bit of a bugger, because the only way I found to use Comparer.OrdinalIgnoreCase (which will ignore case sensitivity) was to use it in list. So if anyone has an idea how to make this a bit smarter, you're more than welcome :-)

       

      http://www.thebiccountant.com/2016/10/27/tame-case-sensitivity-power-query-powerbi/

      • ImkeF's avatar
        ImkeF
        Icon for Community Champion rankCommunity Champion

        So if you want a distinct of all columns in the table, it's pretty easy:

         

        Table.Distinct(Table, Comparer.OrdinalIgnoreCase)

         

         

        Still need to figure out how to handle column-selection in it.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi smoupre,

       

      Yes I have millions of row in the database. My apology I cannot post the data.

       

      I have posted this issue in the link you mention. Hopfully they come out with something more convenient.

       

      Anonymous and ImkeF my data is not case sensitive. Yet this happen. I'd tried your code just in case but the results are the same.

       

       

      • ImkeF's avatar
        ImkeF
        Icon for Community Champion rankCommunity Champion

        Anonymous another thing you can try is to trim & clean before the remove-duplicates-step. Maybe there are some issues with non-printable characters or sth similar:

         

  • LarsSchreiber's avatar
    LarsSchreiber
    Icon for Responsive Resident rankResponsive Resident

    Hey Anonymous@

     

    I wrote a post already in February about the different understanding of duplicates of Power Query and Power Pivot here, but ImkeFs idea of using the Comparer.OrdialIgnoreCase porperty is great and simple. 

     

     

    Thanks a lot :-)