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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

How do i create a dynamic URL in Powerbi source query

I am trying to load data from Log analytics and i am i want to create dynamic URLS for each customer when i open PBIT template file.

 

eg --> let Source = Json.Document(Web.Contents("https://api.loganalytics.io/v1/workspaces/WORKSPACEID/query", 

 

I want WORKSPACEID to be dynamic. I tried two methods

 

1. Reading the WORKSPACEID from text file and ( i have a per customer folder so, chosing right file is taken cared of using the parameterised path to file)

2. Using this, i created an additional query to extract only WORKSPACEID.

 

= let Source = Json.Document(Web.Contents( "https://api.loganalytics.io/v1/workspaces/"& "#LAWorkspace" &"/query",

When i use this query name in the Main query to log analytics, it throws error.

 

Expression.Error: We cannot apply operator & to types Text and List.

I also tried creating a new table with all WORKSPACE ID's and customer name mapping and tried to using ID from this table , even this fails.

"Expression.Error: We cannot apply operator & to types Text and List."

let Source = Json.Document(Web.Contents("https://api.loganalytics.io/v1/workspaces/" & WorkspaceID & "/query",

 

Any help would be appreciated, already spent a day , going crazy 😞

3 REPLIES 3
YIWEI
New Member

Once I publish the report to powerbi cloud, and then embed this to another website A, is it possible to change the parameter from front-end user side? or how can this parameter be easily changed by the website A.

v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?


Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

First of all, please create a parameter named "WORKSPACEID and format as text, then try to use the following query:

 

let
  Source = Json.Document(Web.Contents("https://api.loganalytics.io/v1/workspaces",[RelativePath="/" & WORKSPACEID &" /query"]))

in
  Source

 

10.jpg

 


Best regards,

 

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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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