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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
sudhak
Frequent Visitor

Data refresh error

Hi,

 

I am taking data from M language query from Azure Application insights. But while refreshing the data, we are getting error (500: internal server error).

Refresh failed.PNG

 

Below is the error i am getting from power bi. But now able to understand the issue. 

 

DataSource.Error: Web.Contents failed to get contents from 'https://api.applicationinsights.io/v1/apps/22128845-03d6-4b8a-ba5e-71b1c5ed509e/query?query=pageViews%0A%7C%20where%20timestamp%20%3E%3D%20datetime%282018-02-07T14%3A59%3A59.999Z%29%20and%20timestamp%20%3C%20datetime%282018-02-14T15%3A00%3A00.001Z%29%0A%7C%20where%20%28itemType%20%3D%3D%20%27pageView%27%20and%20%28timestamp%20%3E%3D%20datetime%282018-02-07T15%3A00%3A00.000Z%29%20and%20timestamp%20%3C%3D%20datetime%282018-02-14T15%3A00%3A00.000Z%29%29%29%0A%7C%20top%201000%20by%20timestamp%20desc%0A&x-ms-app=AAPBI&prefer=ai.response-thinning%3Dtrue' (500): Internal Server Error
Details:
    DataSourceKind=Web
    DataSourcePath=https://api.applicationinsights.io/v1/apps/22128845-03d6-4b8a-ba5e-71b1c5ed509e/query
    Url=https://api.applicationinsights.io/v1/apps/22128845-03d6-4b8a-ba5e-71b1c5ed509e/query?query=pageViews%0A%7C%20where%20timestamp%20%3E%3D%20datetime%282018-02-07T14%3A59%3A59.999Z%29%20and%20timestamp%20%3C%20datetime%282018-02-14T15%3A00%3A00.001Z%29%0A%7C%20where%20%28itemType%20%3D%3D%20%27pageView%27%20and%20%28timestamp%20%3E%3D%20datetime%282018-02-07T15%3A00%3A00.000Z%29%20and%20timestamp%20%3C%3D%20datetime%282018-02-14T15%3A00%3A00.000Z%29%29%29%0A%7C%20top%201000%20by%20timestamp%20desc%0A&x-ms-app=AAPBI&prefer=ai.response-thinning%3Dtrue

Below is the source code i am using: 

let AnalyticsQuery =
let Source = Json.Document(Web.Contents("https://api.applicationinsights.io/v1/apps/22128845-03d6-4b8a-ba5e-71b1c5ed509e/query", 
[Query=[#"query"="pageViews
| where timestamp >= datetime(2018-02-07T14:59:59.999Z) and timestamp < datetime(2018-02-14T15:00:00.001Z)
| where (itemType == 'pageView' and (timestamp >= datetime(2018-02-07T15:00:00.000Z) and timestamp <= datetime(2018-02-14T15:00:00.000Z)))
| top 1000 by timestamp desc
",#"x-ms-app"="AAPBI",#"prefer"="ai.response-thinning=true"],Timeout=#duration(1,0,4,0)])),
TypeMap = #table(
{ "AnalyticsTypes", "Type" }, 
{ 
{ "string",   Text.Type },
{ "int",      Int32.Type },
{ "long",     Int64.Type },
{ "real",     Double.Type },
{ "timespan", Duration.Type },
{ "datetime", DateTimeZone.Type },
{ "bool",     Logical.Type },
{ "guid",     Text.Type },
{ "dynamic",  Text.Type }
}),
DataTable = Source[tables]{0},
Columns = Table.FromRecords(DataTable[columns]),
ColumnsWithType = Table.Join(Columns, {"type"}, TypeMap , {"AnalyticsTypes"}),
Rows = Table.FromRows(DataTable[rows], Columns[name]), 
Table = Table.TransformColumnTypes(Rows, Table.ToList(ColumnsWithType, (c) => { c{0}, c{3}}))
in
Table
in
    AnalyticsQuery

 

Can anyone please help what is wrong here? How we can get the data refreshed?

Any help with this is really appreciated!

 

Thanks,

2 REPLIES 2
bcharlto
Frequent Visitor

Did you figure it out? I am getting the same error...

Anonymous
Not applicable

@sudhak Are you using a gateway? I don't recall when the change was implemented, but it was awhile ago that you need a gateway when using web.contents i believe.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.