Updated on

Character.Type is a type facet in the Power Query M language. It represents one of the type claims belonging to ‘type text’. It is used primarily for interacting with external systems like Power BI, where precise textual type information is beneficial. The base type of ‘type text’ in Power Query is a general text type, but facets like Character.Type provide additional details (such as indicating the data is a special character) to external systems or tools for improved text processing and storage.


Generally, you will face a facet when transforming column types. You can transform a column into the specified type by using Table.TransformColumnTypes:

Table.TransformColumnTypes( Source, {{ "myColumn", Character.Type }} )

Or when adding a column using Table.AddColumn:

Table.AddColumn( Source, "myColumn", "myText", Character.Type" )

To inspect the kind of value you are dealing with, you can make use of the Table.Schema function. Applying it to a table returns a table with information about your columns. The Table.SingleRow function then transforms the result into a record, for easier reading.

  a =  "myText",
   // Ascribes a type claim facet for 'type text'
  b = Value.ReplaceType( a, Character.Type ),
  // Returns a table containing a value with the ascribed "Character.Type" 
  c = #table(type table [Col1 = Value.Type( b ) ], { b } ), 
  // Shows the Table information, including typeName and value kind
  d = Table.Schema( c ),
  // For easier viewing, return table as record
  e = Table.SingleRow( d )

Related facets

Other related facets are:

BI Gorilla Blog

Contribute » | Contributors: Rick de Groot