Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
johnlhaase
Helper I
Helper I

Identifying All Uppercase letters in a column

Hello

 

What is the M code for identifying a row/record with all uppercase letters?

 

Thanks

John Haase

2 REPLIES 2
johnlhaase
Helper I
Helper I

Hello here is the solution that works for my sitution. You can subsitute {0..9} or lower upper case in the {..}

= Table.AddColumn(#"Renamed Columns1", "New", each Text.Select([Name], {"a".."z"}))

 

Thanks

collinsg
Super User
Super User

Good day johnlhaase,

The essence of the following is to take a string and compare it to itself in uppercase, i.e.

if "string" = Text.Upper("string") then true else false

The idea could be applied to a single column or a record. In the case of a record the steps are:

  1. Add a column, converting each record to a list.
  2. Combine the elements of each list as text.
  3. Compare each combined text with itself in upper case.

Here is some sample code, the interesting part starting with #"Convert record to text".

Hope this helps

 

let
    Source = Table.FromRows(
        Json.Document(
            Binary.Decompress(
                Binary.FromText(
                    "i45WSszJUcjJL08tUtJBYRsaGSvF6kQrOfr4KIQGBLgGAcWQ2QaG+kBkZGBkAlbmm1mRmqLgnFicCpRD4YQEhbqClSCbjmwS0CY9E1MMy1AMSUxKxrQGxelQBchiWE1AtgKbASiaUBSDFMQCAA==",
                    BinaryEncoding.Base64
                ),
                Compression.Deflate
            )
        ),
        let
            _t = ((type nullable text) meta [Serialized.Text = true])
        in
            type table [#"Column 1" = _t, #"Column 2" = _t, #"Other types" = _t]
    ),
    #"Convert record to text" = Table.AddColumn(Source, "Is All Upper", each Text.Combine(Record.ToList(_))),
    #"Test for uppercase" = Table.TransformColumns(
        #"Convert record to text", {{"Is All Upper", each if _ = Text.Upper((_)) then true else false}}
    ),
    #"Changed Type" = Table.TransformColumnTypes(#"Test for uppercase", {{"Is All Upper", type logical}})
in
    #"Changed Type"

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.