Text.Upper converts every character in a text value to uppercase. Available in Excel (Power Query), Power BI Desktop, and Power BI Service.
If you want to standardize text so that values like north star come out as NORTH STAR, this is the function to use. It works on a single value or across a whole column.
Syntax of Text.Upper Function
Text.Upper(text as nullable text, optional culture as nullable text) as nullable text
where
text(required, nullable text). The text value you want to convert to uppercase.culture(optional, nullable text). A culture name such as"en-US"or"tr-TR"that controls how letters are cased. Omit it to use the default casing, or pass one when a language capitalizes letters differently.
Returns: the text with all characters converted to uppercase. If text is null, it returns null.
In plain terms, you hand it some text and it gives you back the same text with every letter capitalized.
Example 1: Convert a text value to uppercase
Take a lowercase phrase and make it all caps.
Text.Upper("north star")
Result: NORTH STAR
Every letter is capitalized and the space is left untouched.
Example 2: Uppercase with a culture
Some alphabets capitalize letters differently, so you can pass a culture to get the right result.
Text.Upper("istanbul","tr-TR")
Result: İSTANBUL
The tr-TR culture maps the dotless lowercase i to the dotted capital İ, which is correct in Turkish. Without the culture you would get ISTANBUL instead.
Example 3: Uppercase a table column
Uppercasing a whole column is the most common real use of Text.Upper.
Say you have a Stores query with a Code and a Country column.
Here is the starting data:
| Code | Country |
|---|---|
| REF-451 | canada |
| REF-882 | mexico |
| REF-903 | brazil |
Pass Text.Upper to Table.TransformColumns to apply it to the Country column:
let
Source = Excel.CurrentWorkbook(){[Name="Stores"]}[Content],
Result = Table.TransformColumns(Source,{{"Country",Text.Upper}})
in
Result
The result has the country names in uppercase:
| Code | Country |
|---|---|
| REF-451 | CANADA |
| REF-882 | MEXICO |
| REF-903 | BRAZIL |
Passing Text.Upper as a bare function reference, with no each, is the clean way to do this. Table.TransformColumns feeds each cell value straight into it. To uppercase items in a list rather than a column, pass it to List.Transform the same way.
Example 4: Pass a null value
A null input does not error, it passes straight through.
Text.Upper(null)
Result: null
So a blank cell in a column stays blank instead of breaking the query.
Things to keep in mind with Text.Upper
- Only the first argument is required. With no
culture, casing uses the invariant culture, which is fine for English text. - Culture matters for non-English alphabets. Turkish
iis the classic case (see Example 2). Pass the matching culture when a language capitalizes letters its own way. - A number throws an error.
Text.Upper(42)raisesExpression.Errorbecause the input is not text. Convert it first withText.From. - It only changes case.
Text.Upperdoes not trim spaces or strip stray characters. Pair it withText.TrimorText.Cleanif the values need tidying too. - To build a new uppercase column instead of replacing one, use
Table.AddColumnwitheach Text.Upper([Column])and keep the original.
Performance and query folding
Against a foldable source like SQL Server, Text.Upper can fold to a native UPPER(...) call so the work happens in the database. On Excel, CSV, and folder sources there is nothing to fold to, so it runs locally, which handles thousands of rows without trouble.
Common questions about Text.Upper
What is the difference between Text.Upper, Text.Lower, and Text.Proper?
Text.Upper capitalizes every letter, Text.Lower makes every letter lowercase, and Text.Proper capitalizes the first letter of each word.
List of All Power Query Functions
Related Power Query Functions / Articles: