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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.