Forum Discussion

elliejiang20's avatar
elliejiang20
Icon for Microsoft Employee rankMicrosoft Employee
4 years ago
Solved

How to make Power BI desktop show data case-sensitive?

I have columnA with data AAA and aaa. They show in Power Query correct with case-sensitive: AAA and aaa under columnA, but load to Power BI desktop, only show AAA under columnA, so my slicer for colu...
  • KNP's avatar
    KNP
    4 years ago

    The code in the last part of the article shows how to incorporate it into a query.

     

    let
      Source = SourceData,
      ToList = Table.AddColumn(Source, "Chars", each Text.ToList([OriginalText])),
      LowerCaseChars = {"a" .. "z"},
      AddInvisibleChars = Table.AddColumn(
        ToList,
        "AddInvisibleChars",
        each List.Transform(
          [Chars],
          each if List.Contains(LowerCaseChars, _) then _ & Character.FromNumber(8203) else _
        )
      ),
      RecombineList = Table.AddColumn(
        AddInvisibleChars,
        "OutputText",
        each Text.Combine([AddInvisibleChars]),
        type text
      ),
      RemovedOtherColumns = Table.SelectColumns(RecombineList, {"OutputText"})
    in
      RemovedOtherColumns

     

    Basically, if you copy and pasted everything from 'ToList' to the end you could add that to the end of your query. All you would need to change is 'Source' and '[OriginalText]' in the 'ToList' line to match your previous step and column name with the lower case characters.

     

    I've attached the PBIX file from the blog post if you'd rather use that.

    If you need further help, please post the M code for the query you're trying to incorporate this in to.