Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Handling Case Sensitivity in Power BI

Hi, 

 

The table has column name  "Tags" under which it has three values-  [ "name", "Name", "NAme"]

 

I need a distinct count answer to be 3 not as 1,

Total = DISTINCTCOUNT('table'[Tags])

 

Is there as solution.?

 

Pls Help me out

 

Thanks and Regards.

Sri Vignesh

3 Replies

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

    Hi Anonymous ,

    The main Power BI engine (that means datasets, relationships, DAX etc) is case insensitive while the Power Query engine is case sensitive. 
    Here are the articles for further reading and possible solution:

    https://www.sqlbi.com/articles/letter-case-sensitivity-in-dax-power-bi-and-analysis-services/

    https://blog.crossjoin.co.uk/2019/10/06/power-bi-and-case-sensitivity/

    https://www.excelcampus.com/powerquery/count-unique-rows-power-query/ 

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

    In desktop, DAX is case-insensitive, so if you type directly, all you get is 1 .But you can enter the data in Query Editor . I will introduce the steps of this operation , you can refer to it .

    (1)Transform Data in desktop of Power BI , and add a new Blank Query .

    (2)Enter the following formula (Character.FromNumber(8203) is distinguished from other values as a character, but it is invisible in desktop and does not take up space ) .

    let

        Source =#table(

        type table [Tags = text],

            {

                {"name" },

                {"Name" & Character.FromNumber(8203)},

                {"NAme"& Character.FromNumber(8204)}

        })

    in

        Source

    (3)Then back to desktop , in the Data View , you can see the table.

    (4)Create a measure to count the value of Tags .

    Total = DISTINCTCOUNT(Query1[Tags])

    The effect is as shown:

    I have attached my pbix file, you can refer to it .

     

    Best Regards

    Community Support Team _ Ailsa Tao

     

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you so much Ailsa Tao.. It is resolved since we created a table,

       

      how about if we import table from SQL server with same like tags column of 30,000 rows, how we distinct each tag name and add those query to the column. It will be much helpful, if we resolve it.