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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors