We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi all
I'm querying ARG in PowerQuery, but one of my tables is returning empty, which is breaking the rest of the query. I have added error handling and i'm just trying to basically get an empty table with the correct column names, but I am running into a problem with the empty row that I'm trying to insert...
Current code:
This is the code and the error - whatever I put into that first row it returns this error....
Would really appreciate the help!! Thanks in advance!
Solved! Go to Solution.
Hi @zantarel ,
Not 100% sure what you mean by "one of my tables is returning empty" as there's a couple of ways to interpret this, but I'm assuming it's just completely void i.e. no columns or anything. If so, try something along these lines:
let
Source = #table(1, {{1}}),
remCol = Table.RemoveColumns(Source,{"Column1"}),
// Error handling from here ===>
buildAltTable = #table({"id", "name", "type", "tenantId", "kind", "location", "resourceGroup", "subscriptionId", "managedBy", "sku", "plan", "properties", "tags", "identity", "zones", "extendedLocation"}, {}),
repTable = if List.Count(Table.ColumnNames(remCol)) = 0 then buildAltTable else remCol
in
repTable
Obviously this can be condensed into a single step, if you prefer, something like this:
let
Source = #table(1, {{1}}),
remCol = Table.RemoveColumns(Source,{"Column1"}),
// Error handling from here ===>
repTable = if List.Count(Table.ColumnNames(remCol)) = 0
then #table({"id", "name", "type", "tenantId", "kind", "location", "resourceGroup", "subscriptionId", "managedBy", "sku", "plan", "properties", "tags", "identity", "zones", "extendedLocation"}, {})
else remCol
in
repTable
Pete
Proud to be a Datanaut!
Thank you! That fixed it for me!! Appreciate the help!
No problem, happy help 🙂👍
Pete
Proud to be a Datanaut!
Hi @zantarel ,
Not 100% sure what you mean by "one of my tables is returning empty" as there's a couple of ways to interpret this, but I'm assuming it's just completely void i.e. no columns or anything. If so, try something along these lines:
let
Source = #table(1, {{1}}),
remCol = Table.RemoveColumns(Source,{"Column1"}),
// Error handling from here ===>
buildAltTable = #table({"id", "name", "type", "tenantId", "kind", "location", "resourceGroup", "subscriptionId", "managedBy", "sku", "plan", "properties", "tags", "identity", "zones", "extendedLocation"}, {}),
repTable = if List.Count(Table.ColumnNames(remCol)) = 0 then buildAltTable else remCol
in
repTable
Obviously this can be condensed into a single step, if you prefer, something like this:
let
Source = #table(1, {{1}}),
remCol = Table.RemoveColumns(Source,{"Column1"}),
// Error handling from here ===>
repTable = if List.Count(Table.ColumnNames(remCol)) = 0
then #table({"id", "name", "type", "tenantId", "kind", "location", "resourceGroup", "subscriptionId", "managedBy", "sku", "plan", "properties", "tags", "identity", "zones", "extendedLocation"}, {})
else remCol
in
repTable
Pete
Proud to be a Datanaut!
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.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 10 | |
| 8 | |
| 7 | |
| 7 | |
| 5 |