Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

URL Parameters in view mode

Hello there,

 

Few months ago POLITICO publised an nice data viz:

https://www.politico.eu/europe-poll-of-polls/european-parliament-elections-2019/

 

I would like to replicate it:

 

They have an EU page where show aggregate data. On the top there flags where you could select a Memeber States in order to drill-down on country level.

 

They change member states using the paramenter Country, therefore when they click Austria they go to the following link: 

 

https://app.powerbi.com/view?r=eyJrIjoiZTA5N2VkYWQtYmNiMS00YWFmLWEwZWQtOGY4MmExNTlmZjllIiwidCI6ImMyOGQyZTEyLTA5ODgtNGFjZi1iZGJhLTExOTU4MmU4ZDA4ZCIsImMiOjl9&Country=Austria

 

When they click Belgiumthey go to the following link:

 

https://app.powerbi.com/view?r=eyJrIjoiZTA5N2VkYWQtYmNiMS00YWFmLWEwZWQtOGY4MmExNTlmZjllIiwidCI6ImMyOGQyZTEyLTA5ODgtNGFjZi1iZGJhLTExOTU4MmU4ZDA4ZCIsImMiOjl9&Country=Belgium

 

and so on.

 

I know  that there is a service url filter doc, see the link below

https://docs.microsoft.com/en-us/power-bi/service-url-filters

but they use another way to write the URL ==> URL?filter=Table/Field eq 'value'. I would like to have like POLITICO URL&Country=Austria

 

Does anyone know I could develop something like this?

 

Thank you very much for your example.

Salva

4 Replies

  • v-xuding-msft's avatar
    v-xuding-msft
    Community Support

    Hi Anonymous ,

    Embedding report with JavaScript can have the effect. You could try the script below :

     

    function show(pageName, filterValue){
    //Set the baseUrl to the embed url you get from the Power BI UI
    var newUrl = baseUrl + "&pageName=" + pageName;
    if(null != filterValue && "" != filterValue)
    {/code>
    newUrl += "&Country='" + filterValue + "'";
    }
    //Assumes there’s an iFrame on the page with id="iFrame"
    var report = document.getElementById("iFrame");
    report.src=newUrl;
    }

    For more details, you could reference the blog : Easily embed secure Power BI reports in your internal portals or websites.

     

     

    Best Regards,

    Xue Ding

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello v-xuding-msft ,

       

      Thank you for your help, it is very help a lot.

       

      Howerver, I was thinking to replicate the POLITICO page like this

       

      https://app.powerbi.com/view?r=eyJrIjoiZTA5N2VkYWQtYmNiMS00YWFmLWEwZWQtOGY4MmExNTlmZjllIiwidCI6ImMyOGQyZTEyLTA5ODgtNGFjZi1iZGJhLTExOTU4MmU4ZDA4ZCIsImMiOjl9
      &pageName=ReportSectionfc084e199e4490b57ced&Country=Spain

       

      as you could see they have publish like "Public to web" so everyone could see the data and they have added a paramenter country where you could change from one to another member states.

       

      Do know how I can create the parameter when I use "Public to web" as well?

       

      Thanks,

      Salva

      • v-xuding-msft's avatar
        v-xuding-msft
        Community Support

        Hi Anonymous ,

        As I known, URL parameters is not supported to "Publish to web".  For now, there is no functionality to implement it directly. It needs us to develop with javascript like that website did.

         

        Best Regards,

        Xue Ding

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Kudos are nice too.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello anonymous, I'm exactly need the same as the Politico dashboard but could not find how to implement and made that filters works this way. I'm really wondering, did you find the answer and implement it accordingly ?