Reputation: 61
I have a dataset coming into power bi from CSV where certain rows have been pushed to the right because there's a comma in the description. Once i apply a datatype change, this creates errors with the presence of text in a numeric column.
What i want to do is something like = try [col1] otherwise [col2]
, except that i want to do this for several columns where the result isn't necessarily the column where the error is.
So if there's an error in column 1, give me the value in column 3, but if there's no error in column 1, then column 2 has the value i want. So something like = if([Col1] = Error, [Col3], [Col2])
Upvotes: 1
Views: 268
Reputation: 40204
Try this:
if (try [col1])[HasError] then [col3] else [col2]
Here is the reference I used to create this expression:
https://learn.microsoft.com/en-us/power-query/handlingerrors
Upvotes: 2