Current user variable

Variables

Catering dashboards to a specific viewer is possible with the use of the {CURRENT_USER} variable. The {CURRENT_USER} variable stores the email of the current user viewing a dashboard. Use this value in your charts and dashboards to build dashboards and charts that can be filtered based on who is currently viewing the dashboard. You can use this variable as you would any other dashboard variable.

Charts

Interactive Mode

When using the {CURRENT_USER} variable to filter, select the column or field you would like to filter and set it equal to a custom value. In the custom value field, type in {CURRENT_USER}.

Filter by User Email

SQL Mode

Use the {CURRENT_USER} variable like you would any other dashboard variable by simply typing in {CURRENT_USER} within your queries and using it with any column or field you wish to filter.

For example:

SELECT COUNT(DISTINCT "tablename"."users") AS "Count of users
FROM "public"."tablename" AS "tablename"
WHERE (("tablename"."user_email" = {CURRENT_USER}))
LIMIT 10000;

You can also select the current user’s email by selecting {CURRENT_USER} in the select clause of your query.

Dashboard

Use the {CURRENT_USER} variable as a global variable to filter your entire dashboard by adding it to all charts on your dashboard. The variable itself is already available to use like Relative Date Variables so you don’t need to create it like any of the other Dashboard Variables. If you want to display the value of the variable, add a Text Element and set that Text Element to equal the value of the current user variable by typing in {CURRENT_USER} as seen in the example below:

Add Text on the dashboard and filter as desired


Related Variables Help Articles

See more