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
Anonymous
Not applicable

Using parameters to get data from dynamic url

Hello,

 

I have not been able to find a solution to my problem even tho there are similar solved problems in this forum.

What I am trying to do is use parameters (from cell*s or table*s) in an url.

 

To define the parameters I tried two different solutions.

The first one was to write the value in a table and get the value via a Query.

It looks like this:

 

let
    Source = Excel.CurrentWorkbook(){[Name="TestenParams"]}[Content],
    TestParam1 = Record.Field(Source{0},"Start")
in
    TestParam1

 

 

The other one was defined by using the built-in option of the Power Query Editor.

 

I would prefer to use the first variant but for testing purposes I tried both.

 

The next step was trying to replace a part of the url with the parameter.

A simplified example of the important part of the Query would look like this:

 

let
    TestParam1 = Start,
    Source = Json.Document(Web.Contents("https://someurl.com/somecategory/64dfg8d484-4fsd4-fwewtg1w8/records?fromHere="&TestParam1&"&toHere=1525426100", [Headers=[Accept="*/*", #"Content-Type"="application/json"]])),
    #"Converted to Table" = Record.ToTable(Source),

 

 

For some reason I have not been able to create a working url using parameters.

Most of the time I get the "Expression.Error: We cannot apply operator & to types Text and Number" error.

Why am I not able to use parameters this way?

 

Thank you.

LPLA

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Source = Json.Document(Web.Contents("https://someurl.com/somecategory/64dfg8d484-4fsd4-fwewtg1w8/records?fromHere="& Text.From(TestParam1) &"&toHere=1525426100", [Headers=[Accept="*/*", #"Content-Type"="application/json"]]))

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

Source = Json.Document(Web.Contents("https://someurl.com/somecategory/64dfg8d484-4fsd4-fwewtg1w8/records?fromHere="& Text.From(TestParam1) &"&toHere=1525426100", [Headers=[Accept="*/*", #"Content-Type"="application/json"]]))

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

Thanks a lot. I was searching for some kind of conversion but couldn't find it.
Unfortunately this created a new issue.

After using the parameter I get the following error:

Formula.Firewall: Query 'Testen' (step 'Expanded Value.chargebacks') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.

I already got this error when trying something very similar, but I could'nt find a way to solve it.
The solution https://community.powerbi.com/t5/Desktop/Formula-Firewall-Query-references-other-queries-so-it-may-n... seems to be correct but I can find the "Privacy" tab when going to File -> Options -> General -> Privacy Settings... but there isn't really anything for me to turn off or on.

I'll try to get this fixed because I'm trying to automate some of the time consuming steps in my workflow.
Still me original problem was solved by CNENFRNL so I will tag it as the solution.

Thank you.
LPLA

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.

Top Solution Authors
Top Kudoed Authors