Forum Discussion

eyeball's avatar
eyeball
Frequent Visitor
9 years ago
Solved

Passing a parameter to a URL

Hi,

 

I'm just starting out in Power BI and was wondering if it's possible to pass a patameter from one tile to another that is getting its data from a web URL.

 

So, what I'm thinking is that on a report there would be a list of funds that is sourced from an internal system and when one is selected the fund code is passed to a web url and real time web data is brought back and displayed in the report in another tile.

 

Hope that makes sense,

Thanks!

  • Anonymous's avatar
    Anonymous
    9 years ago

    Hi eyeball,

     

    >>I'm just starting out in Power BI and was wondering if it's possible to pass a patameter from one tile to another that is getting its data from a web URL.

    I haven't found a way to use tiles to achieve your requirement . In my opinion, you can use the power query and parameters to get data from web content.

     

    For example:

     

    Creata parameter from other query.

     

     

    Write a custom function to call api:

     

    let
        CallAPi= (
            URL as text,
            Token as text,
            optional Timeout as number
        ) as any => 
    let
        WebTimeout = if Timeout = null then #duration(0,0,0,100) else #duration(0,0,0,Timeout) , 
        WebResponse = Web.Contents(URL&"?Token="&Token, 
            [Headers = [Authorization="xxxxx",
                        #"Content-Type"="application/json",
                        Accept="application/json"],
             Timeout = WebTimeout]),
        
        output = formatfunction(WebResponse) //format the response
    in
        output 
    in
        CallAPi

     

    Add new query to invoke this function:

     

    let
        Source = CallAPi("URL", ParaList, 10000)
    in
        Source

     

     

    After above steps, you can modify parameter to change the source table.

     

     

    Reference link:

    Web.Contents

    Is it possible to dynamically update the source URL with Power Query ?

     

     

    Regards,

    Xiaoxin Sheng

  • Anonymous's avatar
    Anonymous
    9 years ago

    eyeball,

    I think the suggestion from Anonymous is a neat approach to this issue, but there may be a couple of points to note that I've hit recently:

    1. I don't think you can edit parameters in the Power BI service, only in Desktop - so if your clients are only using the PBI service, this won't work;
    2. Even on Desktop, once you click through the several steps to edit a parameter, you then need to "Apply Change" to force a refresh on the new dataset - so the user interface is pretty clunky just now; and
    3. Using a parameter based on a query to form a URL for a (second) external query will invoke the "Formula.Firewall" error about mixing internal and external data sources - you'll have to be prepared to turn on the "Fast Combine" option to work around that by checking: "Ignore the Privacy Levels...." under Settings -> Options -> Privacy - see http://www.excelguru.ca/blog/2015/03/11/power-query-errors-please-rebuild-this-data-combination/.

     

    There is some discussion on this sort of issue in this idea -https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/11723658-allow-publish-time-parameters

     

    I recommend voting for this, or another, idea to help get improved support for this sort of requirement.

     

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi eyeball,

     

    >>I'm just starting out in Power BI and was wondering if it's possible to pass a patameter from one tile to another that is getting its data from a web URL.

    I haven't found a way to use tiles to achieve your requirement . In my opinion, you can use the power query and parameters to get data from web content.

     

    For example:

     

    Creata parameter from other query.

     

     

    Write a custom function to call api:

     

    let
        CallAPi= (
            URL as text,
            Token as text,
            optional Timeout as number
        ) as any => 
    let
        WebTimeout = if Timeout = null then #duration(0,0,0,100) else #duration(0,0,0,Timeout) , 
        WebResponse = Web.Contents(URL&"?Token="&Token, 
            [Headers = [Authorization="xxxxx",
                        #"Content-Type"="application/json",
                        Accept="application/json"],
             Timeout = WebTimeout]),
        
        output = formatfunction(WebResponse) //format the response
    in
        output 
    in
        CallAPi

     

    Add new query to invoke this function:

     

    let
        Source = CallAPi("URL", ParaList, 10000)
    in
        Source

     

     

    After above steps, you can modify parameter to change the source table.

     

     

    Reference link:

    Web.Contents

    Is it possible to dynamically update the source URL with Power Query ?

     

     

    Regards,

    Xiaoxin Sheng

    • Anonymous's avatar
      Anonymous
      Not applicable

      eyeball,

      I think the suggestion from Anonymous is a neat approach to this issue, but there may be a couple of points to note that I've hit recently:

      1. I don't think you can edit parameters in the Power BI service, only in Desktop - so if your clients are only using the PBI service, this won't work;
      2. Even on Desktop, once you click through the several steps to edit a parameter, you then need to "Apply Change" to force a refresh on the new dataset - so the user interface is pretty clunky just now; and
      3. Using a parameter based on a query to form a URL for a (second) external query will invoke the "Formula.Firewall" error about mixing internal and external data sources - you'll have to be prepared to turn on the "Fast Combine" option to work around that by checking: "Ignore the Privacy Levels...." under Settings -> Options -> Privacy - see http://www.excelguru.ca/blog/2015/03/11/power-query-errors-please-rebuild-this-data-combination/.

       

      There is some discussion on this sort of issue in this idea -https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/11723658-allow-publish-time-parameters

       

      I recommend voting for this, or another, idea to help get improved support for this sort of requirement.