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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
susheeltyagi
Helper I
Helper I

How to Dynamically select the parameter for Advance query from Publish Report

How to Run Time (While Publish) the select the custome Parameter from Parameter List using the Advance Editors in Power BI.

Actually I am importing the data (Events log) from Azure Applicationinsight (like device Id, Date, Version Number, Status etc). The query has created by Export function in Azure and implemented by BlankQuery as data source in Power BI ( sample query has as mentioned below).

 

Now I would like to select the records by dynamically (Desktop and Web browser) change the duration from Parameter list. When I Publish it then their have no option for parameter list

 

 

Query 1.

 

let AnalyticsQuery =

let Source = Json.Document(Web.Contents("https://api.applicationinsights.io/v1/apps/XXXXXXXXXXXXXXXXXXXX/query",

[Query=[#"query"="customEvents

| where name == 'Devices'

| project custDim = parse_json(tostring(customDimensions))

| project Properties = tostring(custDim.Properties), tostring(custDim.IngressTimestamp)",#"x-ms-app"="AAPBI",#"timespan"=Text.From(Timefrom) ,#"prefer"="ai.response-thinning=true"],Timeout=#duration(0,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

 

 

I have created the Parameter List #"timefrom" in Power BI.  and replace the hardcoded value from Parameter name #"timespan"=Text.From(Timefrom)

 

Parameter List :

Timefrom(PT12H)

 

Last Hour

4 hours

12 hours

24 hours

48 hours

3 days

7 days

30 Days

90 Days

         

PT1H

PT4H

PT12H

PT24H

PT48H

P3D

P7D

P30D

P90D

 

"PT12H" meta [IsParameterQuery=true, List={"PT1H", "PT2H", "PT12H", "PT24H", "P3D", "P7D"}, DefaultValue="PT1H", Type="Text", IsParameterQueryRequired=true]

 

Output :

susheeltyagi_0-1597067449241.png

 

susheeltyagi_0-1597068301304.png

 

I am new to Power Bi. Please help me.

 

Thanks

 

Susheel

0 REPLIES 0

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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