Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.