Forum Discussion
Select Columns contains errors
- 6 years ago
Hello Anonymous
This solution should give you a perfect overview in witch Row and Column the error occured, with all details of the reason.
let Source = #table ( {"TaskList SignOff Date and Time","TaskList SignOff Date and Time2"}, { {"43849,4374997106","43849,4374997106"}, {"43849,4583329861","43849,4583329861"}, {"43849,4791662616","43849,4791662616"}, {"43849,499999537","43849,499999537"}, {"43849,5208328125","43849,5208328125"}, {"43849,541666088","43849,541666088"}, {"43849,5624993634","43849,5624993634"}, {"43849,5833326389","43849,5833326389"}, {"43849,6041659144","43849,6041659144"}, {"43849,6249991898","43849,6249991898"}, {"43849,6458324653","43849,6458324653"}, {"43849,6666657407","43849,6666657407"}, {"43849,6874990162","43849,6874990162"}, {"43849,7083322917","43849,7083322917"}, {"43849,7291655671","43849,7291655671"}, {"43849,7499988426","43849,7499988426"}, {"43849,7708321181","43849,7708321181"}, {"43849,7916653935","43849,7916653935"}, {"43849,812498669","43849,812498669"}, {"abc","abc"}, {"tets","tets"}, {"dfs","dfs"}, {"sdf","sdf"}, {"sdfs","sdfs"} } ), AddedIndex = Table.AddIndexColumn ( Source, "Index", 1, 1 ), ChangeType = Table.TransformColumnTypes ( AddedIndex, {{"TaskList SignOff Date and Time", Int64.Type}} ), GroupAndTranspose = Table.Group ( ChangeType, {"Index"}, {{"AllRows", each Table.FromColumns( {List.Difference( Table.ColumnNames(_),{"Index"})}& Table.ToColumns( Table.Transpose(Table.RemoveColumns(_,"Index"),{"Value"})),{"ColumnName", "Value"}), type table [TaskList SignOff Date and Time=number, TaskList SignOff Date and Time2=text]}} ), ExpandAllRows = Table.ExpandTableColumn ( GroupAndTranspose, "AllRows", {"ColumnName", "Value"} ), CheckError = Table.AddColumn ( ExpandAllRows, "Benutzerdefiniert", each try [Value] ), Expand = Table.ExpandRecordColumn ( CheckError, "Benutzerdefiniert", {"HasError", "Value", "Error"}, {"HasError", "Value.1", "Error"} ), FilterForError = Table.SelectRows ( Expand, each ( [HasError] = true ) ), ExpandError = Table.ExpandRecordColumn ( FilterForError, "Error", {"Reason", "Message", "Detail"}, {"Reason", "Message", "Detail"} ) in ExpandErrorCopy paste this code to the advanced editor in a new blank query to see how the solution works. If this solution fits your need, copy and past a part of it and implement it in your query
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hello Anonymous
This solution should give you a perfect overview in witch Row and Column the error occured, with all details of the reason.
let
Source = #table
(
{"TaskList SignOff Date and Time","TaskList SignOff Date and Time2"},
{ {"43849,4374997106","43849,4374997106"}, {"43849,4583329861","43849,4583329861"}, {"43849,4791662616","43849,4791662616"}, {"43849,499999537","43849,499999537"}, {"43849,5208328125","43849,5208328125"}, {"43849,541666088","43849,541666088"}, {"43849,5624993634","43849,5624993634"}, {"43849,5833326389","43849,5833326389"}, {"43849,6041659144","43849,6041659144"}, {"43849,6249991898","43849,6249991898"}, {"43849,6458324653","43849,6458324653"}, {"43849,6666657407","43849,6666657407"}, {"43849,6874990162","43849,6874990162"}, {"43849,7083322917","43849,7083322917"}, {"43849,7291655671","43849,7291655671"}, {"43849,7499988426","43849,7499988426"}, {"43849,7708321181","43849,7708321181"}, {"43849,7916653935","43849,7916653935"}, {"43849,812498669","43849,812498669"}, {"abc","abc"}, {"tets","tets"}, {"dfs","dfs"}, {"sdf","sdf"}, {"sdfs","sdfs"} }
),
AddedIndex = Table.AddIndexColumn
(
Source,
"Index",
1,
1
),
ChangeType = Table.TransformColumnTypes
(
AddedIndex,
{{"TaskList SignOff Date and Time", Int64.Type}}
),
GroupAndTranspose = Table.Group
(
ChangeType,
{"Index"},
{{"AllRows", each Table.FromColumns( {List.Difference( Table.ColumnNames(_),{"Index"})}& Table.ToColumns( Table.Transpose(Table.RemoveColumns(_,"Index"),{"Value"})),{"ColumnName", "Value"}), type table [TaskList SignOff Date and Time=number, TaskList SignOff Date and Time2=text]}}
),
ExpandAllRows = Table.ExpandTableColumn
(
GroupAndTranspose,
"AllRows",
{"ColumnName", "Value"}
),
CheckError = Table.AddColumn
(
ExpandAllRows,
"Benutzerdefiniert",
each try [Value]
),
Expand = Table.ExpandRecordColumn
(
CheckError,
"Benutzerdefiniert",
{"HasError", "Value", "Error"},
{"HasError", "Value.1", "Error"}
),
FilterForError = Table.SelectRows
(
Expand,
each
(
[HasError] = true
)
),
ExpandError = Table.ExpandRecordColumn
(
FilterForError,
"Error",
{"Reason", "Message", "Detail"},
{"Reason", "Message", "Detail"}
)
in
ExpandError
Copy paste this code to the advanced editor in a new blank query to see how the solution works. If this solution fits your need, copy and past a part of it and implement it in your query
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Amazing! 👏👏👏