Showing results for 
Search instead for 
Did you mean: 
Jamesgu Occasional Visitor
Occasional Visitor

Azure Application Insights queries export to Power BI

Currently I'm looking to enhance my power bi query which returns data regarding service availability. At present my requirement is 1, 7, 30 day views but that will be changing. Unfortunately it looks like need to create multiple queries to handle this, or a single query to return 30 days and then add a slicer to get customer results which gets tricky with the volume of data for 30 days. Is there a way to dynamically query App Insights from within a power bi report? The continous stream and stream analytics weren't helping with this issue.



From the advanced editor my current query looks like: 


let AnalyticsQuery =
let Source = Json.Document(Web.Contents("",
[Query=[#"query"="let timerange = 1d;
| where timestamp > ago(timerange)
| summarize allRequests = count() , successes= countif(success == true or toint(resultCode) < 500), failures=countif(success != true and  ( isempty(resultCode) or toint(resultCode) >= 500)) by operation_Name, ""Service Name""
| extend availability = 100.0*successes / allRequests
| order by availability asc nulls last",#"x-ms-app"="AAPBI"],Timeout=#duration(0,0,4,0)])),
TypeMap = #table(
{ "DataType", "Type" },
{ "Double",   Double.Type },
{ "Int64",    Int64.Type },
{ "Int32",    Int32.Type },
{ "Int16",    Int16.Type },
{ "UInt64",   Number.Type },
{ "UInt32",   Number.Type },
{ "UInt16",   Number.Type },
{ "Byte",     Byte.Type },
{ "Single",   Single.Type },
{ "Decimal",  Decimal.Type },
{ "TimeSpan", Duration.Type },
{ "DateTime", DateTimeZone.Type },
{ "String",   Text.Type },
{ "Boolean",  Logical.Type },
{ "SByte",    Logical.Type }
DataTable = Source[Tables]{0},
Columns = Table.FromRecords(DataTable[Columns]),
ColumnsWithType = Table.Join(Columns, {"DataType"}, TypeMap , {"DataType"}),
Rows = Table.FromRows(DataTable[Rows], Columns[ColumnName]),
Table = Table.TransformColumnTypes(Rows, Table.ToList(ColumnsWithType, (c) => { c{0 }, c{3}}))
    #"Renamed Columns" = Table.RenameColumns(AnalyticsQuery,{{"Column1", "Service"}})
in #"Renamed Columns"

Microsoft v-jiascu-msft

Re: Azure Application Insights queries export to Power BI

Hi @Jamesgu,


Usually, we create 1, 7, 30 views in the reports. We get all the data in and then we can create 1, 7, 30 views by formulas, filters, or slicers. You can create reports or pages for n day view from the same dataset. Simple question, if we already get 30 days data, why should we get 1 day data again. So let's do it with DAX formula.


Best Regards!


Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

New Ranks and Rank Icons in 2020

New Ranks and Rank Icons in 2020

Read the announcement for more information!

New Kudos Given Badges Coming

New Kudos Given Badges Coming

We're rolling out new Kudos Given badges. Find out how many Kudos you've given.

November 2019 Community Highlights

November 2019 Community Highlights

Get an overview of the events and great community content from November.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)