Forum Discussion

mjfulke's avatar
mjfulke
Microsoft Employee
10 years ago
Solved

Generating unique keys from case-sensitive data in Power BI Desktop

Sharing with community:

 

I ran into an issue yesterday while working with a customer evaluating Power BI. They have a MySQL source database. Their dimension table uses letters for primary keys, and the case matters. An example would be:

 

A           Store #1             Oregon

a            Store #2             Washington

B           Store #3             California

 

In the Query designer for Power BI Desktop, everything  looks fine. Capitalization is preserved. Once the data is imported into PBI Desktop, everything is capitalized and then there are duplicate key values such that:

 

A           STORE #1           OREGON

A           STORE #2           WASHINGTON

B           STORE #3           CALIFORNIA

 

 

  •  Answer to my own question:

     

    Power BI is case in-sensitive.  Solution is to add an index column OR  convert the key column data to a binary representation of value "Binary.ToText(Text.ToBinary([key column]),1))"

     

     

8 Replies

  • mjfulke's avatar
    mjfulke
    Microsoft Employee

     Answer to my own question:

     

    Power BI is case in-sensitive.  Solution is to add an index column OR  convert the key column data to a binary representation of value "Binary.ToText(Text.ToBinary([key column]),1))"

     

     

    • Massimo's avatar
      Massimo
      Frequent Visitor

      HI, I'am a basic user of power BI. I would like to understand how to use the formula that you have indicated :"Binary.ToText(Text.ToBinary([key column]),1))" . If I create a column with the formula that you entered, Power IB telling me it does not recognize Binary.ToText. Can you help me to understand better how to do to implement your solution ? thank you so much.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Binary.ToText is a power query function. It must be done as a step in the query editor. I think you're trying to do it in the table editor.