Splitter.SplitByNothing Function in Power Query
The Splitter.SplitByNothing function in Power Query returns a function that does no splitting, returning its argument as a single element list.
Syntax
Splitter.SplitByNothing() as function
Purpose The function returns a function that takes an input (e.g., text, number, or list) and wraps it in a single-element list without performing any splitting. This is useful when you want to override default splitting behavior in Power Query transformations, such as when working with Table.FromList
or Table.SplitColumn
.
Example: Splitting Using Splitter.SplitByNothing() with Table.SplitColumn.
Power Query M
let Source = Table.FromRecords( { [Data = "1-Ashish-568"], [Data = "2-Katrina-855"], [Data = "3-Alia-380"], [Data = "4-Vicky-458"], [Data = "5-Mohini-278"], [Data = "6-Meenakshi-289"], [Data = "7-Esha-875"], [Data = "8-Anjali-380"] } ), return = Table.SplitColumn(Source, "Data", Splitter.SplitByNothing(), {"Combined"}) in return
The output of the above code is shown below:
Combined |
---|
1-Ashish-568 |
2-Katrina-855 |
3-Alia-380 |
4-Vicky-458 |
5-Mohini-278 |
6-Meenakshi-289 |
7-Esha-875 |
8-Anjali-380 |
Example: Creating a Table from a List Using Splitter.SplitByNothing().
Power Query M
let // Step 1: Create a list of values MyList = {1, 2, 3}, // Step 2: Convert the list to a table MyTable = Table.FromList( MyList, Splitter.SplitByNothing(), {"Numbers"} // Optional column name ) in MyTable
The output of the above code is shown below:
Numbers |
---|
1 |
2 |
3 |