Show link in custom dimension

I have a report that provides "Username" and other data about users. I use "Username" in many different reports/dashboards, but I need to display the "Username" with a link (to somewhere) in only one report.
dimension: user_name_link
{
 label: "User Name with a link"
 description: "User's full name with a link to ..."
 sql: ... ;;
 hidden: no
 link: {
  label: "Label"
  url: ..."
 }
}
I don't want to create a separate dimension for it as "Username with the link" as I need it only once. So I assume it's better to create a custom dimension. How to create a custom dimension with a link?
Is it possible to create a condition based on a look ID? - I know it's possible to create an IF condition based on user attributes, but I don't want to create a new permission just for one report.
Could you please help with the solution for this?

Solved Solved
0 2 435
1 ACCEPTED SOLUTION

Firstly, in my view, it's pretty normal to create a separate hidden dimension for this.  If you don't want to bloat the base view with these types of special fields, you could define them in a separate view with a specific naming convention and only include them in the explore where they are required.

Secondly, I don't think it's possible to make links on a custom dimension / table calculation.

Thirdly, if you still don't want to create a separate field for this, I think it IS possible to make your link work on only a singular dashboard (not look).  To do this, you could leverage the liquid variable _explore._dashboard_url, similar to the following.  Note that when the link resolves to empty, the link will not appear at all

dimension: user_name_link
{
 label: "User Name with a link"
 description: "User's full name with a link to ..."
 sql: ... ;;
 hidden: no
 link: {
  label: "Label"
  url: "{% if_explore._dashboard_url == '[numeric id of the specific dashboard]' %}[your target url]{% endif %}"
 }
}

View solution in original post

2 REPLIES 2
Top Labels in this Space