Forum Discussion

Asantos2020's avatar
Asantos2020
Advocate II
6 years ago

Pass Users' Parameter into json query url

Hello,

 

I'm not sure I've found a definite No to this.

I am pulling data via a url, but this needs to have its StartDate defined by a parameter where the user can define the number of months back the data is supposed to be.

So, accessing the report today, the data should be from July/28th to Nov/28. 

I've been trying to pass a Query Parameter below, but although the Current Value says it's 4, I'm getting data from the whole year:

 

Json.Document(Web.Contents("https://api.com.br/Server_2.0.0_api/PBI/documents/data?FromDate="&Date.ToText(DateTime.Date(Date.AddMonths(DateTime.LocalNow(), -MonthParameter)))&"&ToDate="&DateTime.ToText((DateTime.LocalNow()), "yyyy-MM-dd")&"", [Headers=[Accept="application/json", Authorization="Bearer eyJhbGciOiJ..."]]))

 

How to have the user have access to this parameter on Power BI Service?

 

Cheers,

Antonio Santos