cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
magnifybi
Resolver I
Resolver I

Dynamic Web.Contents Power BI Refresh Error

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

Using The “Skip Test Connection” Option For Power BI Data Sources To Avoid Scheduled Refresh Failure...

 

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&timestatus=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 

2 REPLIES 2
magnifybi
Resolver I
Resolver I

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&timestatus=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:

v-kelly-msft_0-1619078769415.png

 

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Helpful resources

Announcements
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors