2019-05-15

OData: Request failed (404)

I'm trying to get data from SharePoint via an Odata query to Power BI using the Odata connector. My query is perfectly legal in a browser (or Powershell) but in Power BI the query results in a 404 return code. Googling about the error the best reply I get is:
the above error could occur when OData URL string is large or large number of columns are pulled into Power BI Desktop. Please check your URL and try to reduce columns, then check if the error goes away. 
I cannot find any limits or actually anything that tells me what the f-ng error is. I reduce my request to a minimum and I still got the same 404 responce.
It seems the only Odata I successfully process is a simple get one list  Odata request. So I download needed lists one by one and the by clicking around manage to join the lists in Power BI and find this code in the advanced editor:

let
   Source = SharePoint.Tables("https://thecompanysharepoint/metadata/application", [ApiVersion = 15]),
   #"cffb758e-476c-4673-84f5-7be931f86eb2" = Source{[Id="cffb758e-476c-4673-84f5-7be931f86eb2"]}[Items],
   #"Renamed Columns" = Table.RenameColumns(#"cffb758e-476c-4673-84f5-7be931f86eb2",{{"ID", "ID.1"}}),
   #"Merged Queries" = Table.NestedJoin(#"Renamed Columns",{"Currency CodeId"},ISOCurrencyCode,{"Id"},"ISOCurrencyCode"
,JoinKind.LeftOuter),
   #"Expanded ISOCurrencyCode" = Table.ExpandTableColumn(#"Merged Queries", "ISOCurrencyCode", {"ContentTypeID"
, "CurrencyCode", "CurrencyName", "CurrencyNumCode", "CurrencyISOEdition", "CurrencyStatusValue", "CurrencyComment"
, "CurrencyAC_Reporting", "Id", "ContentType", "Modified", "Created", "CreatedById", "ModifiedById", "Owshiddenversion", "Version"
, "Path", "CurrencyStatus", "CreatedBy", "ModifiedBy", "Attachments"}, {"ISOCurrencyCode.ContentTypeID", "ISOCurrencyCode.CurrencyCode",
"ISOCurrencyCode.CurrencyName", "ISOCurrencyCode.CurrencyNumCode", "ISOCurrencyCode.CurrencyISOEdition"
, "ISOCurrencyCode.CurrencyStatusValue", "ISOCurrencyCode.CurrencyComment",
"ISOCurrencyCode.CurrencyAC_Reporting", "ISOCurrencyCode.Id", "ISOCurrencyCode.ContentType", "ISOCurrencyCode.Modified"
, "ISOCurrencyCode.Created", "ISOCurrencyCode.CreatedById", "ISOCurrencyCode.ModifiedById", "ISOCurrencyCode.Owshiddenversion"
, "ISOCurrencyCode.Version", "ISOCurrencyCode.Path", "ISOCurrencyCode.CurrencyStatus", "ISOCurrencyCode.CreatedBy"
, "ISOCurrencyCode.ModifiedBy",
"ISOCurrencyCode.Attachments"}),
   #"Filtered Rows" = Table.SelectRows(#"Expanded ISOCurrencyCode", each ([Month] = 2) and ([Year] = "2016"))
in
   #"Filtered Rows"
I modified this code with great care to get a result I'm happy with since I cannot find any reference or guidance at all for this scripting language which I even do not know the name of.
Anyway now it works, and I got the requested result.