Hope you could help. I have the below code in my power query and it is working great with a connected power pivot table. As soon as the Source line is returning "This table is empty" it all goes wrong:
- Power query return error message that the 2 lines following the source line, are not recognized.
- The table in the power pivot is showing the last results from the last working query.
I need the table to be empty if there are no results.
How do i do that?
let
UrlSource = Excel.CurrentWorkbook(){[Name="Table6"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(UrlSource,{{"Url", type text}}),
Url = #"Changed Type"{0}[Url],
UserInput = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Sagsnummer Type" = Table.TransformColumnTypes(UserInput,{{"Sagsnummer", type text}}),
Sagsnummer = #"Changed Sagsnummer Type"{0}[Sagsnummer],
Source = OData.Feed(Url & "/FileContacts?$select=CustomLabel_Summary,Name/Name1&$expand=Name&$filter=File/FileNo eq '" & Sagsnummer & "'"),
#"Expanded Name" = Table.ExpandRecordColumn(Source, "Name", {"Name1"}, {"Name.Name1"}),
#"Renamed Columns" = Table.RenameColumns(#"Expanded Name",{{"CustomLabel_Summary", "Rolle"}, {"Name.Name1", "Kontakt"}})
in
#"Renamed Columns"