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.
Hi,
I am using the below paramters to pass in the URL to get the data from a web source which based on the start date and end date:
the below is from Advance Editor:
let
Source = Json.Document(Web.Contents("http://175.20.9.16:41000/PS/v1/ABC/Device/Meter?start_time=" & DeviceSD & "&end_time=" & DeviceED))
in
Source
I can successfully get the data for these paramaters (hard coded date), Now my requirement is to make these current values dynamic. The current value for the parameters "DeviceED" should be current datetime (like now()) and "DeviceSD" should be 3 days back datetime (like now()-3) rather than passing a hard coded datetime values.
Please suggest how to achieve this.
StartDate
EndDate
Solved! Go to Solution.
Hi @jitpbi,
Perhaps you can try to split your url string and add optional parameters 'relative path' and 'query' to confirm if they works on power bi service side:
let
url="http://175.20.9.16:41000/",
Source = Web.Contents(url,
[
RelativePath="PS/v1/ABC/Device/Meter",
Query =
[
start_time =
DateTimeZone.ToText(DateTimeZone.From(Date.AddDays (DateTimeZone.UtcNow(),-3)),"yyyy-MM-ddThh:mm:ssZ"),
end_time =
DateTimeZone.ToText(DateTimeZone.UtcNow(),"yyyy-MM-ddThh:mm:ssZ")
]
]),
Result=Json.Document(Source)
in
Result
Using The RelativePath And Query Options With Web.Contents() In Power Query And Power BI M Code
Regards,
Xiaoxin Sheng
I got the solution for this in my another post:
https://community.powerbi.com/t5/Desktop/Dynamic-values-in-paramater/m-p/1346168#M578929
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
83 | |
67 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |