Forum Discussion
LotteLaugesen
4 years agoHelper V
How to get a default value (zero) when Table.SelectRows doesn't return a value
Hi
Is there a way to return zero when [order number] isn't present in FT_table?
Here is my query:
(let currentOrder = [order number] in Table.SelectRows(FT_Table, each [order number] = currentOrder)){0}[SupplierID]
BR
Lotte
Found a solution - replace error...
It's generally better to handle the errors rather than replace them.
Try this:
let currentOrder = [order number], filteredTable = Table.SelectRows(FT_Table, each [order number] = currentOrder)) in try filteredTable{0}[SupplierID] otherwise 0
3 Replies
- LotteLaugesenHelper V
Found a solution - replace error...
- AlexisOlsonSuper User
It's generally better to handle the errors rather than replace them.
Try this:
let currentOrder = [order number], filteredTable = Table.SelectRows(FT_Table, each [order number] = currentOrder)) in try filteredTable{0}[SupplierID] otherwise 0- LotteLaugesenHelper V
Thank you so much 😊