Forum Discussion
This dataset includes a dynamic data source. Since dynamic data sources aren't refreshed in the Powe
Hello,
I am trying to connect my weclapp account to powe bi services. But I get this error:
This dataset includes a dynamic data source. Since dynamic data sources aren't refreshed in the Power BI service, this dataset won't be refreshed. Learn more: https://aka.ms/dynamic-data-sources.
My function is :
let
GetSalesOrders = (optional PageSize as number, optional StartDate as nullable date, optional EndDate as nullable date, optional RequiredColumns as list) =>
let
// Defaults
PageSize = if PageSize <> null then PageSize else 1000,
token = "**************",
BaseURL = "https://brandgarage.weclapp.com",
// Pagination
AllPages = List.Generate(
() => [Page = 1, Data = {}],
each not List.IsEmpty([Data]) or [Page] = 1,
each [
Data =
let
QueryParams =
if StartDate <> null and EndDate <> null then
[
pageSize = Text.From(PageSize),
sort = "-id",
page = Text.From([Page]),
#"filter=createdDate>=" = Date.ToText(StartDate, "yyyy-MM-dd"),
#"filter=createdDate<=" = Date.ToText(EndDate, "yyyy-MM-dd")
]
else if StartDate <> null then
[
pageSize = Text.From(PageSize),
sort = "-id",
page = Text.From([Page]),
#"filter=createdDate>=" = Date.ToText(StartDate, "yyyy-MM-dd")
]
else
[
pageSize = Text.From(PageSize),
sort = "-id",
page = Text.From([Page])
],
WebCall = Json.Document(
Web.Contents(
BaseURL,
[
RelativePath = "webapp/api/v1/salesOrder", // 🚨 fixed endpoint
Query = QueryParams,
Headers = [
AuthenticationToken = token,
#"Content-Type" = "application/json",
Accept = "application/json"
]
]
)
),
CurrentData = if Value.Is(WebCall[result], type list) then WebCall[result] else {WebCall[result]}
in
CurrentData,
Page = [Page] + 1
],
each [Data]
),
CombinedList = List.Combine(AllPages),
OutputTable = Table.FromList(CombinedList, Splitter.SplitByNothing(), null),
ExpandedTable =
if Table.RowCount(OutputTable) > 0 then
Table.ExpandRecordColumn(OutputTable, "Column1", Record.FieldNames(OutputTable{0}[Column1]))
else
OutputTable,
FinalTable =
if RequiredColumns <> null then
Table.SelectColumns(ExpandedTable, RequiredColumns, MissingField.Ignore)
else
ExpandedTable
in
FinalTable
in
GetSalesOrders
Your structure with RelativePath and Query is exactly the supported exception on Microsoft documents.
But you must ensure BaseURL is a literal string, not a parameterized or function-passed valueYou may try below adjusted M code (Hardcode the BaseURL string directly inside Web.Contents instead of keeping it in a variable)
WebCall = Json.Document(
Web.Contents(
"https://brandgarage.weclapp.com", // hardcoded
[
RelativePath = "webapp/api/v1/salesOrder",
Query = QueryParams,
Headers = [
AuthenticationToken = token,
#"Content-Type" = "application/json",
Accept = "application/json"
]
]
)
),Power BI Service blocks refresh for queries with dynamic URLs. Your use of Web.Contents with changing query parameters (like StartDate, EndDate, Page) makes the source dynamic.
Fix:
Make the URL structure static by keeping the same field names in the Query record, even if some values are null. That way, Power BI can validate the source at design time.
5 Replies
- MasonMASuper User
Your structure with RelativePath and Query is exactly the supported exception on Microsoft documents.
But you must ensure BaseURL is a literal string, not a parameterized or function-passed valueYou may try below adjusted M code (Hardcode the BaseURL string directly inside Web.Contents instead of keeping it in a variable)
WebCall = Json.Document(
Web.Contents(
"https://brandgarage.weclapp.com", // hardcoded
[
RelativePath = "webapp/api/v1/salesOrder",
Query = QueryParams,
Headers = [
AuthenticationToken = token,
#"Content-Type" = "application/json",
Accept = "application/json"
]
]
)
), - Shahid12523Community Champion
Power BI Service blocks refresh for queries with dynamic URLs. Your use of Web.Contents with changing query parameters (like StartDate, EndDate, Page) makes the source dynamic.
Fix:
Make the URL structure static by keeping the same field names in the Query record, even if some values are null. That way, Power BI can validate the source at design time. - v-hjannapuCommunity Support
Hi HesamMontazer,
I would also take a moment to thank Shahid12523 , MasonMA for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
Regards,
Harshitha.- v-hjannapuCommunity Support
Hi HesamMontazer,
I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We are always here to support you.
Regards,
Harshitha.- v-hjannapuCommunity Support
Hi HesamMontazer,
I wanted to follow up and see if you have had a chance to review the information that was shared. If you have any additional questions or need further clarification, please don’t hesitate to reach out. I am here to assist with any concerns you might have.
Regards,
Harshitha.