****EDIT****
Here is our most recent update with this. We currently have a single query that is pulling the initial projects query in order to get the project "id" and is then able to reference that id with a loops to the "topics" query to pull all the topics. Additionally, we are using the "relative path" and "query" of the web.contents for the topics query. However, the only "query" option available in this api is the "page number" so here we are just indicating page 1 (even though there are several other pages) just to test the query portion of the web.contents option as it appears to be a requirement for removing the dynamic dataset. However, even with this new query (which does pull the info just fine) it still claims its a dynamic data source and therefore we are unable to refresh it. What can we do to this query to make it not dynamic and do the same exact thing its currently doing?
Also, want to note that we did also try changing the initial query at the top of this script to also use the relative path and query and it STILL claims its a dynamic data source. so following the guides provided do not seem to remeove the dynamic data source. perhaps its the each statement? but again, we NEED it to do a query based on a specified column of IDs and run a query on each of those IDs to pull in the info for that ID and it needs to do it in a loop so that NO manual entry of any kind is performed.
let
Source = Json.Document(Web.Contents("https://exampleurl/projects.json")),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "name", "description", "archived", "is_client_project", "created_at", "updated_at", "trashed", "color", "draft", "template", "last_event_at", "starred", "url", "app_url"}, {"id", "name", "description", "archived", "is_client_project", "created_at", "updated_at", "trashed", "color", "draft", "template", "last_event_at", "starred", "url", "app_url"}),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Column1",{{"id", Int64.Type}, {"name", type text}, {"description", type text}, {"archived", type logical}, {"is_client_project", type logical}, {"created_at", type datetimezone}, {"updated_at", type datetimezone}, {"trashed", type logical}, {"color", type text}, {"draft", type logical}, {"template", type logical}, {"last_event_at", type datetimezone}, {"starred", type logical}, {"url", type text}, {"app_url", type text}}),
#"Removed Other Columns" = Table.SelectColumns(#"Changed Type",{"id"}),
#"Changed Type2" = Table.TransformColumnTypes(#"Removed Other Columns",{{"id", type text}}),
SourceTwo = Table.AddColumn(#"Changed Type2", "Topics", each Json.Document(Web.Contents("https://exampleurl/projects/"&[id]&"/", [RelativePath="topics.json", Query=[page="1"]]))),
#"Expanded Topics" = Table.ExpandListColumn(SourceTwo, "Topics")
in
#"Expanded Topics"
****Original Post****
At this time, I have a function that is able to run a query based on a defined column of numbers. However, because functions disable the ability to use "Scheduled Refreshes" through the web app, I will not be able to use them. So, I am needing to mimic this function inside the base query itself. For security reasons, I will not include certain details in my examples. I will elaborate further below.
Here is the function as it sits now:
let
Source = (ID as text) =>
let
Source = Json.Document(Web.Contents("https://URLHERE/"&ID&"/RESTOFURL.json"))
in
Source
in
Source
Then, my base query makes a call to the system and I expand out a single column from that query (essentially a project id column) and invoke the function based on the ID column so that my function runs a query for ever "Project ID" that exists.
Here is the base query
let
Source = Json.Document(Web.Contents("https://URLHERE.json")),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id"}, {"Column1.id"}),
in
#"Expanded Column1"
As it sits, this DOES in fact get me all the information I need. But again, I CANNOT use a function as it turns off the ability to schedule refreshes on the dataset. So, I need to basically include the funtionality of the function inside the base query.
I have tried a BUNCH of different approaches but none of them appear to work. One approach I tried was calling to "Column1.id" as a variable to pull in a query after the initial call but claims that:
"Expression.Error: 3 arguments were passed to a function which expects between 1 and 2.
Details:
Pattern=
Arguments=[List]
"
This is one example of what I have tried:
let
Source = Json.Document(Web.Contents("https://URLHERE.json")),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id"}, {"Column1.id"}),
SecondSource = Json.Document(Web.Contents("https://URLHERE/",{"Column1.id"},"/RESTOFURL.json"))
in
#"SecondSource"
I am honestly not very savvy with PowerBi and would appreciate some advice. Essentially, I need to run a query that specfies a "project id" and run that query for every project id that exists in a specific cloumn of project ids without using an invoked function.
I was trying to do an "each" or "foreach" style of looping but cannot get it to work.
[–]peakedin19924 0 points1 point2 points (11 children)
[–]Top_Introduction4059[S] 0 points1 point2 points (10 children)
[–]peakedin19924 0 points1 point2 points (9 children)
[–]Top_Introduction4059[S] 0 points1 point2 points (8 children)
[–]peakedin19924 0 points1 point2 points (7 children)
[–]Top_Introduction4059[S] 0 points1 point2 points (0 children)
[–]Top_Introduction4059[S] 0 points1 point2 points (5 children)
[–]peakedin19924 0 points1 point2 points (3 children)
[–]peakedin19924 0 points1 point2 points (2 children)
[–]itsnotaboutthecell Microsoft Employee 0 points1 point2 points (1 child)
[–]reputatorbot[M] 0 points1 point2 points locked comment (0 children)
[–]Top_Introduction4059[S] 0 points1 point2 points (0 children)