The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hey guys,
I've been racking my brains for the last week or so trying to get my query converted so I can run a scheduled refresh with my dynamic Web.Contents query.
I have read the following solution and understand the logic behing the concept but am really struggling to apply it to my query;
https://community.powerbi.com/t5/Service/Dynamic-Web-Contents-Power-BI-Refresh-Error/td-p/714526
I have also read all of the associated learning materials and likewise, I get the approach but can't apply it to my use case;
Web.Contents(), M Functions And Dataset Refresh Errors In Power BI
Dynamic Web.Contents() and Power BI Refresh Errors
I would be so grateful if someone could help me figure out how I need to change my below query so I can use this on scheduled refreshes.
I have a table of date ranges that I use this query for via an invoked function and it is working away fine, only issue is converting it.
Apologies if the formatting of the quotes here are wrong, I couldn't figure out how to quote M Query.
(DateRange)=>
let
Source = Web.Contents("https://api.weworked.com/v1/reports/summary?fromdate="&DateRange&"&projects=all&showzeros=0&taskstatus=all×tatus=all&users=all", [Headers=[#"x-api-key"="xxxxxxxxxxxxxxxxxx", #"x-ww-user"="xxx@xxx.co.uk"]]),
#"JSON" = Json.Document(Source),
#"Converted to Table" = Table.FromList(JSON, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"FirstName", "LastName", "UserId", "InternalId", "Rows"}, {"Column1.FirstName", "Column1.LastName", "Column1.UserId", "Column1.InternalId", "Column1.Rows"}),
#"Expanded Column1.Rows" = Table.ExpandListColumn(#"Expanded Column1", "Column1.Rows"),
#"Expanded Column1.Rows1" = Table.ExpandRecordColumn(#"Expanded Column1.Rows", "Column1.Rows", {"project", "task", "taskCode", "billable", "invoiceMethodId", "invoiceMethodName", "rate", "hours", "total"}, {"Column1.Rows.project", "Column1.Rows.task", "Column1.Rows.taskCode", "Column1.Rows.billable", "Column1.Rows.invoiceMethodId", "Column1.Rows.invoiceMethodName", "Column1.Rows.rate", "Column1.Rows.hours", "Column1.Rows.total"})
in
#"Expanded Column1.Rows1"
Thanks,
Jon
This is what I have tried but there is some issue with the Query part, would really love some help.
(DateRange)=>
let
Source = Web.Contents("https://api.weworked.com/v1/reports", [Query=[summary?fromdate="&DateRange&"&projects=all&showzeros=0&taskstatus=all×tatus=all&users=all], Headers=[#"x-api-key"="xxxxxxxxxxxxxxxxxx", #"x-ww-user"="xxx@xxx.co.uk"]]),
#"JSON" = Json.Document(Source),
#"Converted to Table" = Table.FromList(JSON, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"FirstName", "LastName", "UserId", "InternalId", "Rows"}, {"Column1.FirstName", "Column1.LastName", "Column1.UserId", "Column1.InternalId", "Column1.Rows"}),
#"Expanded Column1.Rows" = Table.ExpandListColumn(#"Expanded Column1", "Column1.Rows"),
#"Expanded Column1.Rows1" = Table.ExpandRecordColumn(#"Expanded Column1.Rows", "Column1.Rows", {"project", "task", "taskCode", "billable", "invoiceMethodId", "invoiceMethodName", "rate", "hours", "total"}, {"Column1.Rows.project", "Column1.Rows.task", "Column1.Rows.taskCode", "Column1.Rows.billable", "Column1.Rows.invoiceMethodId", "Column1.Rows.invoiceMethodName", "Column1.Rows.rate", "Column1.Rows.hours", "Column1.Rows.total"})
in
#"Expanded Column1.Rows1"
Hi @magnifybi ,
What issue have you got?Do you have some notifications such as below:
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
76 | |
66 | |
52 | |
50 |
User | Count |
---|---|
121 | |
118 | |
77 | |
64 | |
63 |