Forum Discussion
Refreshing queries with functions doens't work
- 11 years ago
Maybe try this approach..and filter the latest file by date created..Needs more code but it worked - refreshed in PowerBI V1 so probably it will work in V2 as it doesn't use parameters..
I've tried using a function from an Azure Machine Learning Web Service and it works perfectly. I've tried others that work over a set of tables from Excel Files and also from a SQL Database table and they work great as well.
Is there any chance that you can paste the M code here so we can take a look?
- bloigge11 years agoAdvocate IV
Hardcoded Folder Path Query is working - Gateway options are shown:
let Source = Folder.Files("P:\MyFolder\MySubFolder"), #"Sorted Rows" = Table.Sort(Source,{{"Date created", Order.Descending}}), #"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 0, 1), #"Filtered Rows" = Table.SelectRows(#"Added Index", each ([Index] = 0)), tempPath = #"Filtered Rows"{0}[Folder Path], folderPath = Text.Range(Text.Range(tempPath,0,Text.Length(tempPath)-1),Text.PositionOfAny(Text.Range(tempPath,0,Text.Length(tempPath)-1),{"\"},Occurrence.Last) + 1,(Text.Length(tempPath)-1) - (Text.PositionOfAny(Text.Range(tempPath,0,Text.Length(tempPath)-1),{"\"},Occurrence.Last) + 1)), #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Content", "Name", "Extension", "Date accessed", "Date modified", "Attributes", "Folder Path", "Index"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Date created", folderPath}}) in #"Renamed Columns"Creating a function which I then recall multiple times is not working:
let Abfrage = (path as text) => let Source = Folder.Files(path), #"Sorted Rows" = Table.Sort(Source,{{"Date created", Order.Descending}}), #"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 0, 1), #"Filtered Rows" = Table.SelectRows(#"Added Index", each ([Index] = 0)), tempPath = #"Filtered Rows"{0}[Folder Path], folderPath = Text.Range(Text.Range(tempPath,0,Text.Length(tempPath)-1),Text.PositionOfAny(Text.Range(tempPath,0,Text.Length(tempPath)-1),{"\"},Occurrence.Last) + 1,(Text.Length(tempPath)-1) - (Text.PositionOfAny(Text.Range(tempPath,0,Text.Length(tempPath)-1),{"\"},Occurrence.Last) + 1)), #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Content", "Name", "Extension", "Date accessed", "Date modified", "Attributes", "Folder Path", "Index"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Date created", folderPath}}) in #"Renamed Columns" in AbfrageCalling the function:
let Source = GetLatestFile("P:\MyFolder\MySubFolder") in SourceThe notification I get when using a function:
- konstantinos11 years agoMemorable Member
miguel I still didn't find a way to refresh the data in PowerBI service with AzureML OData source..Although in PBI desktop or excel is refreshing..
http://community.powerbi.com/t5/Service/Azure-ML-odata-amp-Refresh/m-p/2516#M694
I must do something the wrong way..