Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I am getting some dynamic column names from a table "Model_Workings" where the column names follow certain business specific criteria - (begin with "abc" and end with "def").
= Table.SelectColumns(
Model_Workings,
List.Select(
Table.ColumnNames(Model_Workings),
each Text.StartsWith(_,"abc") and Text.EndsWith(_,"def")
)
) + 1
My need is to perform some math operations (as simple as +1 for purposes of an example) - and I run into an error that I am currently unable to work my way around - error details below
Expression.Error: We cannot apply operator + to types Table and Number.
Details:
Operator=+
Left=[Table]
Right=1
Please could I get some help on how to get around this issue?
Thanks in advance 🙂
Solved! Go to Solution.
Try the following M Code.
let
// Source data
Model_Workings = Excel.CurrentWorkbook(){[Name="Model_Workings"]}[Content],
// Filter columns
Columns = List.Select(
Table.ColumnNames(Model_Workings),
each Text.StartsWith(_, "abc") or Text.EndsWith(_, "def")
),
// Perform math operation
Result = Table.FromRecords(Table.TransformRows(Model_Workings,
(row) => Record.TransformFields(row, List.Transform(
Columns,
(fieldname) => {fieldname, each Record.Field(row, fieldname) + 1}
))))
in
Result
Try the following M Code.
let
// Source data
Model_Workings = Excel.CurrentWorkbook(){[Name="Model_Workings"]}[Content],
// Filter columns
Columns = List.Select(
Table.ColumnNames(Model_Workings),
each Text.StartsWith(_, "abc") or Text.EndsWith(_, "def")
),
// Perform math operation
Result = Table.FromRecords(Table.TransformRows(Model_Workings,
(row) => Record.TransformFields(row, List.Transform(
Columns,
(fieldname) => {fieldname, each Record.Field(row, fieldname) + 1}
))))
in
Result
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 5 | |
| 4 |