Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
pcardno
Frequent Visitor

Using the USERNAME() function in a calculated column to create a dynamic link URL

Hi,

First time poster, long time reader, so apologies if I miss something in my description.

 

Summary:

I want to create a unique web link in a column that contains values from other columns and the user's username for a 3rd party system, but am struggling to use the username() function as the link in each row as it can't be used in a calculated column.

 

Detail:

I have an application that reads data from a SQL Server DB. If the data is in a certain state, I want to create a link to our JIRA system to populate a Create Ticket page with all the relevant details. All good, except that I need to change the username in the URL to be that of the current user in Power BI.

 

Example table (SimulatedMainTable):

 

Parameter1Parameter2Parameter3JIRALinkUserNameMeasure
abchttp://jira.mysite.com/CreateTicket?param1=a&param2=b&username=myusernameuk003119@site.com
defhttp://jira.mysite.com/CreateTicket?param1=d&param2=e&username=myusernameuk003119@site.com
 
The formula I have in there is this:
 
JIRALink = "http://jira.mysite.com/CreateTicket?param1=" & SimulatedMainTable[Parameter1] & "&param2=" & SimulatedMainTable[Parameter2] & "&username=myusername"
 
And I want to change the "myusername" to be the result of the USERPRINCIPALNAME() function, but can't because that needs to be a measure. If I create a measure and link it in, that's fine as long as I don't try to use the other values from the rows, as then it gets confused and says they're not supported.
 
Is this something that's doable? Happy to add any more details or examples as required, plus consider any options e.g. coding it some other way.
 
 
Paul.
1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @pcardno 


You can create a Masure like.

SELECTEDVALUE( table[hlColumn] ) & USERPRINCIPALNAME()

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

View solution in original post

2 REPLIES 2
Mariusz
Community Champion
Community Champion

Hi @pcardno 


You can create a Masure like.

SELECTEDVALUE( table[hlColumn] ) & USERPRINCIPALNAME()

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

Hi @Mariusz ,

 

That worked, thank you. Unfortunately, it looks like the performance of the function call when applied across a few thousand rows isn't going to work (it just hangs on more than a couple of rows in the table) but your solution did what I was asking for.

 

Thanks again,

 

 

Paul.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.