Hi there!! I’m trying to create a dataflow in power platform.
I solved the issue with an “@” where the function is called recursively. (reference).
But now, I have a new issue. In power platform, I could create the query but I can’t save it. I got this error: “One or more tables references a dynamic data source.”
In power platform I have this problem:
"This query refreshes with no problems in Power BI Desktop. However, when you publish a report that uses this code to PowerBI.com and try to refresh the dataset, you’ll see that refresh fails and returns a rather unhelpful error message:
Data source error Unable to refresh the model (id=1264553) because it references an unsupported data source.
The problem is that when a published dataset is refreshed, Power BI does some static analysis on the code to determine what the data sources for the dataset are and whether the supplied credentials are correct. Unfortunately in some cases, such as when the definition of a data source depends on the parameters from a custom M function, that static analysis fails and therefore the dataset does not refresh."
I change the code as Chris says using RelativePath and Query in web.content, but I couldn’t fix it.
I tried the “skip connection” and use base_url with xxxx.live.dynatrace.com xxx.live.dynatrace.com/api , xxxx.live.dynatrace.com/api/v2 and none of then work.
So this is my code:
let
getMetricsAPIResult = (base_url as text, next_url as text, qty as text, nextPageKey as text, currentList as list) =>
let
apiResult = if nextPageKey = ""
then Json.Document(Web.Contents(base_url,
[
RelativePath = next_url,
Query =
[
pageSize = qty
],
Headers=[Accept="application/json; charset=utf-8", Authorization="Api-Token XXXX"]
]
))
else Json.Document(Web.Contents(base_url,
[
RelativePath = next_url,
Query =
[
nextPageKey = nextPageKey
],
Headers=[Accept="application/json; charset=utf-8", Authorization="Api-Token XXXX"]
]
)),
newList = List.Combine({currentList, apiResult[metrics]}),
hasNext_tmp = apiResult[nextPageKey],
hasNext = if hasNext_tmp is null
then try apiResult[nextPageKeyError]
else try apiResult[nextPageKey],
returnList = if hasNext[HasError]
then newList
else @getMetricsAPIResult(base_url, next_url, qty, apiResult[nextPageKey], newList)
in
returnList,
consulta = getMetricsAPIResult("https://{environmentid}.live.dynatrace.com", "/api/v2/metrics", "500", "", {}),
#"Converted to table" = Table.FromList(consulta, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to table", "Column1", {"metricId", "displayName", "description", "unit"}, {"metricId", "displayName", "description", "unit"}),
#"Transform columns" = Table.TransformColumnTypes(#"Expanded Column1", {{"metricId", type text}, {"displayName", type text}, {"description", type text}, {"unit", type text}}),
#"Replace errors" = Table.ReplaceErrorValues(#"Transform columns", {{"metricId", null}, {"displayName", null}, {"description", null}, {"unit", null}})
in
#"Replace errors"