Forum Discussion

Maria_Buzaglo's avatar
5 years ago

Get Web URL parameter to use it as a measure

Hi,

 

Is it possible to get a parameter from an web URL and have it in a measure? 

 

Example: to have an URL (that ends with '?filter Country/CountryName eq 'Potugal')  and to build a measure that, when presented in a card, will show "Portugal" because it is what is written in the URL filter.

 

Thanks in advance,

 

4 Replies

  • negi007's avatar
    negi007
    Icon for Community Champion rankCommunity Champion

    Maria_Buzaglo If you want to know the username of the person who is accessing the report, you can get the username using username() function in powerbi. Once you have the username, you can use Row Level Security (RLS) to restrict access to the person accessing only his data.

     

    Refer to below links to understand RLS

    https://docs.microsoft.com/en-us/power-bi/admin/service-admin-rls

     

    If you are looking for something else, please let us know what exactly you wish to achieve.

     

  • Maria_Buzaglo , this the service url or a column.

     

    if it a column that has URL, then

    a new column like this in dax 

    right([column], len([column) - (search("eq ",[Column],,0)+3))

    • Maria_Buzaglo's avatar
      Maria_Buzaglo
      Icon for Helper I rankHelper I

      amitchandak 

      Actually it is not a column. My report is in the sharepoint. What I would like is:

      a user sings in the sharepoint and, in the URL sharepoint exist a parameter that is the username. I want to grab that parameter and use it in the power bi report to filter the information just for that user. 

      This is the general thing I want to do.

  • negi007's avatar
    negi007
    Icon for Community Champion rankCommunity Champion

    Maria_Buzaglo I guess you wish to extract the country name from a web URL and then use the name of the country in other measure. It can be done easily, if you have a columns with web URL values, you can extract the name of the country in the powerquery window. You can add a column from existing column, and then this new column can take or exract the country name. 

    Second way is by creating a column in the powerbi desktop there are also it can be done.

     

    I suggest you to try above. If you face any problem, please share few columns values in text format, so that exact solution could be provided to you. Thanks