From fe3303baab27ae11786c89ca93079c609e325ffd Mon Sep 17 00:00:00 2001 From: "mintlify[bot]" <109931778+mintlify[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 10:16:00 +0000 Subject: [PATCH 1/3] Update references/workspace/user-attributes.mdx --- references/workspace/user-attributes.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/references/workspace/user-attributes.mdx b/references/workspace/user-attributes.mdx index ab957d15..da49b2e7 100644 --- a/references/workspace/user-attributes.mdx +++ b/references/workspace/user-attributes.mdx @@ -51,6 +51,10 @@ User attributes can be used in these specific contexts within the model.yaml fil - `required_attributes:` - For column and table access control - `sql_on:` - For filtering joins +User attributes can also be used in: + +- **Chart filter values** - Filter charts dynamically based on the logged-in user + User attributes cannot currently be referenced inside`sql:` tags within the model YAML files. From 44b5ec002fc549601e5bf1ac17381fdb4521d293 Mon Sep 17 00:00:00 2001 From: "mintlify[bot]" <109931778+mintlify[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 10:16:10 +0000 Subject: [PATCH 2/3] Update references/workspace/user-attributes.mdx --- references/workspace/user-attributes.mdx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/references/workspace/user-attributes.mdx b/references/workspace/user-attributes.mdx index da49b2e7..4259ff65 100644 --- a/references/workspace/user-attributes.mdx +++ b/references/workspace/user-attributes.mdx @@ -110,6 +110,27 @@ When referencing user attributes in SQL you can use the following [SQL variables If you are self hosting you can enable [SMTP](/self-host/customize-deployment/configure-smtp-for-lightdash-email-notifications) or [SSO](/self-host/customize-deployment/use-sso-login-for-self-hosted-lightdash) authentication to allow users to verify their email address. +### Using user attributes in chart filter values + +You can reference user attributes directly in chart filter values to create dynamic filters based on the logged-in user. This is useful for creating charts that automatically filter to show only data relevant to the current user. + +To use a user attribute in a filter value, enter one of the following references: + +- `${lightdash.user.email}` - The logged-in user's email address +- `${lightdash.attribute.}` - A custom user attribute value + +For example, if you have a chart showing sales data and you want each user to only see their own records, you can add a filter where `sales_rep_email` is equal to `${lightdash.user.email}`. When the chart runs, the filter value will be replaced with the actual email of the logged-in user. + + + ![User attribute in filter value](/images/references/workspace/user-attribute-filter-value.png) + + +Similarly, you can use custom attributes like `${lightdash.attribute.country}` to filter data based on a user's assigned region or department. + + + If a user attribute referenced in a filter value is not set for the current user, the query will return a `Forbidden` error. + + ### Row filtering with `sql_filter` You can use user attributes to filter the rows returned by a query. This is useful if you want to restrict the data based on the user's attributes. To reference a user attribute in your sql, use the special lightdash reference`${lightdash.attributes. }`. You should use the `IN` operator since the attribute might have multiple values. From 2589a1fbe03247ce426dad29a46f6019f208b92f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Rengel=20Jim=C3=A9nez?= Date: Wed, 11 Feb 2026 11:18:21 +0100 Subject: [PATCH 3/3] Update user-attributes.mdx --- references/workspace/user-attributes.mdx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/references/workspace/user-attributes.mdx b/references/workspace/user-attributes.mdx index 4259ff65..17fac581 100644 --- a/references/workspace/user-attributes.mdx +++ b/references/workspace/user-attributes.mdx @@ -121,10 +121,6 @@ To use a user attribute in a filter value, enter one of the following references For example, if you have a chart showing sales data and you want each user to only see their own records, you can add a filter where `sales_rep_email` is equal to `${lightdash.user.email}`. When the chart runs, the filter value will be replaced with the actual email of the logged-in user. - - ![User attribute in filter value](/images/references/workspace/user-attribute-filter-value.png) - - Similarly, you can use custom attributes like `${lightdash.attribute.country}` to filter data based on a user's assigned region or department. @@ -509,4 +505,4 @@ Let's walk through an example: -In this example, the `${lightdash.attributes.fruit}` will be replaced with `'kiwi','orange','coconut'`. The final SQL will be `my_model.fruit IN ('kiwi','orange','coconut)` \ No newline at end of file +In this example, the `${lightdash.attributes.fruit}` will be replaced with `'kiwi','orange','coconut'`. The final SQL will be `my_model.fruit IN ('kiwi','orange','coconut)`