Text.Reverse
A
- AccessControlEntry.ConditionToIdentities
- Access.Database
- ActiveDirectory.Domains
- AdobeAnalytics.Cubes
- AdoDotNet.DataSource
- AdoDotNet.Query
- AnalysisServices.Database
- AnalysisServices.Databases
- AzureStorage.BlobContents
- AzureStorage.Blobs
- AzureStorage.DataLake
- AzureStorage.DataLakeContents
- AzureStorage.Tables
B
- BinaryFormat.Binary
- BinaryFormat.Byte
- BinaryFormat.ByteOrder
- BinaryFormat.Choice
- BinaryFormat.Decimal
- BinaryFormat.Double
- BinaryFormat.Group
- BinaryFormat.Length
- BinaryFormat.List
- BinaryFormat.Null
- BinaryFormat.Record
- BinaryFormat.SignedInteger16
- BinaryFormat.SignedInteger32
- BinaryFormat.SignedInteger64
- BinaryFormat.Single
- BinaryFormat.Text
- BinaryFormat.Transform
- BinaryFormat.UnsignedInteger16
- BinaryFormat.UnsignedInteger32
- BinaryFormat.UnsignedInteger64
- BinaryFormat.7BitEncodedSignedInteger
- BinaryFormat.7BitEncodedUnsignedInteger
- Binary data
- Binary.ApproximateLength
- Binary.Buffer
- Binary.Combine
- Binary.Compress
- Binary.Decompress
- Binary.From
- Binary.FromList
- Binary.FromText
- Binary.InferContentType
- Binary.Length
- Binary.Range
- Binary.Split
- Binary.ToList
- Binary.ToText
- Binary.View
- Binary.ViewError
- Binary.ViewFunction
- Byte.From
C
- Cdm.Contents
- Character.FromNumber
- Character.ToNumber
- Combiner.CombineTextByDelimiter
- Combiner.CombineTextByEachDelimiter
- Combiner.CombineTextByLengths
- Combiner.CombineTextByPositions
- Combiner.CombineTextByRanges
- Comparer.FromCulture
- Comparer.Ordinal
- Comparer.OrdinalIgnoreCase
- Controlling byte order
- Csv.Document
- Cube.AddAndExpandDimensionColumn
- Cube.AddMeasureColumn
- Cube.ApplyParameter
- Cube.AttributeMemberId
- Cube.AttributeMemberProperty
- Cube.CollapseAndRemoveColumns
- Cube.Dimensions
- Cube.DisplayFolders
- Cube.MeasureProperties
- Cube.MeasureProperty
- Cube.Measures
- Cube.Parameters
- Cube.Properties
- Cube.PropertyKey
- Cube.ReplaceDimensions
- Cube.Transform
- Currency.From
D
- DateTime.AddZone
- DateTime.Date
- DateTime.FixedLocalNow
- DateTime.From
- DateTime.FromFileTime
- DateTime.FromText
- DateTime.IsInCurrentHour
- DateTime.IsInCurrentMinute
- DateTime.IsInCurrentSecond
- DateTime.IsInNextHour
- DateTime.IsInNextMinute
- DateTime.IsInNextNHours
- DateTime.IsInNextNMinutes
- DateTime.IsInNextNSeconds
- DateTime.IsInNextSecond
- DateTime.IsInPreviousHour
- DateTime.IsInPreviousMinute
- DateTime.IsInPreviousNHours
- DateTime.IsInPreviousNMinutes
- DateTime.IsInPreviousNSeconds
- DateTime.IsInPreviousSecond
- DateTime.LocalNow
- DateTime.Time
- DateTime.ToRecord
- DateTime.ToText
- Date.AddDays
- Date.AddMonths
- Date.AddQuarters
- Date.AddWeeks
- Date.AddYears
- Date.Day
- Date.DayOfWeek
- Date.DayOfWeekName
- Date.DayOfYear
- Date.DaysInMonth
- Date.EndOfDay
- Date.EndOfMonth
- Date.EndOfQuarter
- Date.EndOfWeek
- Date.EndOfYear
- Date.From
- Date.FromText
- Date.IsInCurrentDay
- Date.IsInCurrentMonth
- Date.IsInCurrentQuarter
- Date.IsInCurrentWeek
- Date.IsInCurrentYear
- Date.IsInNextDay
- Date.IsInNextMonth
- Date.IsInNextNDays
- Date.IsInNextNMonths
- Date.IsInNextNQuarters
- Date.IsInNextNWeeks
- Date.IsInNextNYears
- Date.IsInNextQuarter
- Date.IsInNextWeek
- Date.IsInNextYear
- Date.IsInPreviousDay
- Date.IsInPreviousMonth
- Date.IsInPreviousNDays
- Date.IsInPreviousNMonths
- Date.IsInPreviousNQuarters
- Date.IsInPreviousNWeeks
- Date.IsInPreviousNYears
- Date.IsInPreviousQuarter
- Date.IsInPreviousWeek
- Date.IsInPreviousYear
- Date.IsInYearToDate
- Date.IsLeapYear
- Date.Month
- Date.MonthName
- Date.QuarterOfYear
- Date.StartOfDay
- Date.StartOfMonth
- Date.StartOfQuarter
- Date.StartOfWeek
- Date.StartOfYear
- Date.ToRecord
- Date.ToText
- Date.WeekOfMonth
- Date.WeekOfYear
- Date.Year
- DB2.Database
- Decimal.From
- Diagnostics.ActivityId
- Diagnostics.Trace
- DirectQueryCapabilities.From
- Double.From
- Duration.Days
- Duration.From
- Duration.FromText
- Duration.Hours
- Duration.Minutes
- Duration.Seconds
- Duration.ToRecord
- Duration.TotalDays
- Duration.TotalHours
- Duration.TotalMinutes
- Duration.TotalSeconds
- Duration.ToText
E
F
G
H
I
L
- Lines.FromBinary
- Lines.FromText
- Lines.ToBinary
- Lines.ToText
- List.Accumulate
- List.AllTrue
- List.Alternate
- List.AnyTrue
- List.Average
- List.Buffer
- List.Combine
- List.ConformToPageReader
- List.Contains
- List.ContainsAll
- List.ContainsAny
- List.Count
- List.Covariance
- List.Dates
- List.DateTimes
- List.DateTimeZones
- List.Difference
- List.Distinct
- List.Durations
- List.FindText
- List.First
- List.FirstN
- List.Generate
- List.InsertRange
- List.Intersect
- List.IsDistinct
- List.IsEmpty
- List.Last
- List.LastN
- List.MatchesAll
- List.MatchesAny
- List.Max
- List.MaxN
- List.Median
- List.Min
- List.MinN
- List.Mode
- List.Modes
- List.NonNullCount
- List.Numbers
- List.Percentile
- List.PositionOf
- List.PositionOfAny
- List.Positions
- List.Product
- List.Random
- List.Range
- List.RemoveFirstN
- List.RemoveItems
- List.RemoveLastN
- List.RemoveMatchingItems
- List.RemoveNulls
- List.RemoveRange
- List.Repeat
- List.ReplaceMatchingItems
- List.ReplaceRange
- List.ReplaceValue
- List.Reverse
- List.Select
- List.Single
- List.SingleOrDefault
- List.Skip
- List.Sort
- List.Split
- List.StandardDeviation
- List.Sum
- List.Times
- List.Transform
- List.TransformMany
- List.Union
- List.Zip
- Logical.From
- Logical.FromText
- Logical.ToText
N
- Name
- Number.Abs
- Number.Acos
- Number.Asin
- Number.Atan
- Number.Atan2
- Number.BitwiseAnd
- Number.BitwiseNot
- Number.BitwiseOr
- Number.BitwiseShiftLeft
- Number.BitwiseShiftRight
- Number.BitwiseXor
- Number.Combinations
- Number.Cos
- Number.Cosh
- Number.Exp
- Number.Factorial
- Number.From
- Number.FromText
- Number.IntegerDivide
- Number.IsEven
- Number.IsNaN
- Number.IsOdd
- Number.Ln
- Number.Log
- Number.Log10
- Number.Mod
- Number.Permutations
- Number.Power
- Number.Random
- Number.RandomBetween
- Number.Round
- Number.RoundAwayFromZero
- Number.RoundDown
- Number.RoundTowardZero
- Number.RoundUp
- Number.Sign
- Number.Sin
- Number.Sinh
- Number.Sqrt
- Number.Tan
- Number.Tanh
- Number.ToText
O
P
R
- RData.FromBinary
- Record.AddField
- Record.Combine
- Record.Field
- Record.FieldCount
- Record.FieldNames
- Record.FieldOrDefault
- Record.FieldValues
- Record.FromList
- Record.FromTable
- Record.HasFields
- Record.RemoveFields
- Record.RenameFields
- Record.ReorderFields
- Record.SelectFields
- Record.ToList
- Record.ToTable
- Record.TransformFields
- Replacer.ReplaceText
- Replacer.ReplaceValue
- RowExpression.Column
- RowExpression.From
- RowExpression.Row
S
- Salesforce.Data
- Salesforce.Reports
- SapBusinessWarehouse.Cubes
- SapHana.Database
- SharePoint.Contents
- SharePoint.Files
- SharePoint.Tables
- Single.From
- Soda.Feed
- Splitter.SplitByNothing
- Splitter.SplitTextByAnyDelimiter
- Splitter.SplitTextByCharacterTransition
- Splitter.SplitTextByDelimiter
- Splitter.SplitTextByEachDelimiter
- Splitter.SplitTextByLengths
- Splitter.SplitTextByPositions
- Splitter.SplitTextByRanges
- Splitter.SplitTextByRepeatedLengths
- Splitter.SplitTextByWhitespace
- SqlExpression.SchemaFrom
- SqlExpression.ToExpression
- Sql.Database
- Sql.Databases
- Sybase.Database
T
- Tables.GetRelationships
- Table.AddColumn
- Table.AddFuzzyClusterColumn
- Table.AddIndexColumn
- Table.AddJoinColumn
- Table.AddKey
- Table.AddRankColumn
- Table.AggregateTableColumn
- Table.AlternateRows
- Table.ApproximateRowCount
- Table.Buffer
- Table.Column
- Table.ColumnCount
- Table.ColumnNames
- Table.ColumnsOfType
- Table.Combine
- Table.CombineColumns
- Table.CombineColumnsToRecord
- Table.ConformToPageReader
- Table.Contains
- Table.ContainsAll
- Table.ContainsAny
- Table.DemoteHeaders
- Table.Distinct
- Table.DuplicateColumn
- Table.ExpandListColumn
- Table.ExpandRecordColumn
- Table.ExpandTableColumn
- Table.FillDown
- Table.FillUp
- Table.FilterWithDataTable
- Table.FindText
- Table.First
- Table.FirstN
- Table.FirstValue
- Table.FromColumns
- Table.FromList
- Table.FromPartitions
- Table.FromRecords
- Table.FromRows
- Table.FromValue
- Table.FuzzyGroup
- Table.FuzzyJoin
- Table.FuzzyNestedJoin
- Table.Group
- Table.HasColumns
- Table.InsertRows
- Table.IsDistinct
- Table.IsEmpty
- Table.Join
- Table.Keys
- Table.Last
- Table.LastN
- Table.MatchesAllRows
- Table.MatchesAnyRows
- Table.Max
- Table.MaxN
- Table.Min
- Table.MinN
- Table.NestedJoin
- Table.Partition
- Table.PartitionValues
- Table.Pivot
- Table.PositionOf
- Table.PositionOfAny
- Table.PrefixColumns
- Table.Profile
- Table.PromoteHeaders
- Table.Range
- Table.RemoveColumns
- Table.RemoveFirstN
- Table.RemoveLastN
- Table.RemoveMatchingRows
- Table.RemoveRows
- Table.RemoveRowsWithErrors
- Table.RenameColumns
- Table.ReorderColumns
- Table.Repeat
- Table.ReplaceErrorValues
- Table.ReplaceKeys
- Table.ReplaceMatchingRows
- Table.ReplaceRelationshipIdentity
- Table.ReplaceRows
- Table.ReplaceValue
- Table.ReverseRows
- Table.RowCount
- Table.Schema
- Table.SelectColumns
- Table.SelectRows
- Table.SelectRowsWithErrors
- Table.SingleRow
- Table.Skip
- Table.Sort
- Table.Split
- Table.SplitAt
- Table.SplitColumn
- Table.ToColumns
- Table.ToList
- Table.ToRecords
- Table.ToRows
- Table.TransformColumnNames
- Table.TransformColumns
- Table.TransformColumnTypes
- Table.TransformRows
- Table.Transpose
- Table.Unpivot
- Table.UnpivotOtherColumns
- Table.View
- Table.ViewError
- Table.ViewFunction
- Teradata.Database
- Text.AfterDelimiter
- Text.At
- Text.BeforeDelimiter
- Text.BetweenDelimiters
- Text.Combine
- Text.Contains
- Text.End
- Text.EndsWith
- Text.From
- Text.FromBinary
- Text.InferNumberType
- Text.Insert
- Text.Length
- Text.Lower
- Text.Middle
- Text.NewGuid
- Text.PadEnd
- Text.PadStart
- Text.PositionOf
- Text.PositionOfAny
- Text.Proper
- Text.Range
- Text.Remove
- Text.RemoveRange
- Text.Repeat
- Text.Replace
- Text.ReplaceRange
- Text.Reverse
- Text.Select
- Text.Split
- Text.SplitAny
- Text.Start
- Text.StartsWith
- Text.ToBinary
- Text.ToList
- Text.Trim
- Text.TrimEnd
- Text.TrimStart
- Text.Upper
- Time.EndOfHour
- Time.From
- Time.FromText
- Time.Hour
- Time.Minute
- Time.Second
- Time.StartOfHour
- Time.ToRecord
- Time.ToText
- Transform operations
- Trigonometry
- Type.AddTableKey
- Type.ClosedRecord
- Type.Facets
- Type.ForFunction
- Type.ForRecord
- Type.FunctionParameters
- Type.FunctionRequiredParameters
- Type.FunctionReturn
- Type.Is
- Type.IsNullable
- Type.IsOpenRecord
- Type.ListItem
- Type.NonNullable
- Type.OpenRecord
- Type.RecordFields
- Type.ReplaceFacets
- Type.ReplaceTableKeys
- Type.TableColumn
- Type.TableKeys
- Type.TableRow
- Type.TableSchema
- Type.Union
V
- Value.Add
- Value.Alternates
- Value.As
- Value.Compare
- Value.Divide
- Value.Equals
- Value.Expression
- Value.Firewall
- Value.FromText
- Value.Is
- Value.Lineage
- Value.Metadata
- Value.Multiply
- Value.NativeQuery
- Value.NullableEquals
- Value.Optimize
- Value.RemoveMetadata
- Value.ReplaceMetadata
- Value.ReplaceType
- Value.Subtract
- Value.Traits
- Value.Type
- Value.VersionIdentity
- Value.Versions
- Value.ViewError
- Value.ViewFunction
- Variable.Value
In this article, we will explore the M code behind the Text.Reverse function and learn how it can be used to manipulate text in Power Query.
Understanding the M Language
Before we dive into the M code behind Text.Reverse, let’s first understand what the M language is. M is the formula language used in Power Query, which is a functional, case-sensitive, and highly expressive language that supports a wide range of data manipulation operations.
M code is created by using the Power Query Editor, which provides an intuitive interface for creating custom queries and transformations. M code is generated automatically as we create queries in the Editor, and we can also edit the code directly to create more complex transformations.
Power Query is designed to be a user-friendly tool that does not require extensive knowledge of coding, but understanding the M language can be helpful in creating more efficient and customized queries.
The Text.Reverse Function
The Text.Reverse function is a built-in function in Power Query that allows us to reverse the order of characters in a given text string. The syntax for this function is as follows:
Text.Reverse(text as nullable text) as nullable text
The function takes a text value as input and returns the same text value with the order of characters reversed. If the input value is null, the function returns null.
Let’s take a look at an example to understand how the Text.Reverse function works:
Text.Reverse("hello world")
The output of this function would be:
"dlrow olleh"
As we can see, the order of characters in the original text string has been reversed.
The M Code Behind Text.Reverse
Now that we understand how the Text.Reverse function works, let’s take a look at the M code behind it. When we use the Text.Reverse function in Power Query, the following M code is generated:
(text) => Text.Reverse(text)
This code defines a lambda function that takes a text value as input and returns the same text value with the order of characters reversed. The lambda function is then applied to the relevant column or data source in the query.
Let’s break down this code further:
– The first part of the code `(text) =>` defines the input parameter for the lambda function. In this case, the input parameter is named `text`.
– The second part of the code `Text.Reverse(text)` defines the operation to be performed on the input parameter. In this case, the Text.Reverse function is applied to the `text` parameter.
Using Text.Reverse in Power Query
Now that we understand the M code behind the Text.Reverse function, let’s see how we can use it in Power Query.
Suppose we have a data source that contains a list of names that are not formatted consistently. Some names are in uppercase, some are in lowercase, and some have extra spaces or punctuation marks. We want to clean up this data and format all names in uppercase.
To achieve this, we can create a new query in Power Query and follow these steps:
1. Import the data source into the query.
2. Select the column containing the names and click on the Transform tab.
3. Click on the Replace Values button and replace any spaces or punctuation marks with an empty string.
4. Click on the Add Column tab and select the Custom Column option.
5. In the Custom Column dialog box, enter a name for the new column and enter the following M code:
(text) => Text.Upper(Text.Reverse(text))
6. Click OK to create the new column.
This M code defines a lambda function that takes a text value as input, applies the Text.Reverse function to it to reverse the order of characters, and then applies the Text.Upper function to convert the text to uppercase.
Once the new column is created, we can remove the original column containing the unformatted names and rename the new column as required.
The Text.Reverse function is a powerful tool in Power Query that allows us to easily manipulate text values. Understanding the M code behind this function can be helpful in creating customized queries and transformations.
By using the Text.Reverse function in combination with other string manipulation functions in Power Query, we can quickly and efficiently clean up and format data, making it easier to analyze and visualize.