Forum Discussion
Dynamic axis label: real name vs. "Anonymous" per user (RLS)
I have Row Level Security (RLS) set up on my fact table, based on a mapping table (Company ↔ Email). When a user logs in with their email, RLS restricts them to see only rows belonging to their own company.
However, I also have a separate Ranking visual where I want all companies to be visible (for benchmarking purposes), but:
- The logged-in user's own company should show its real name
- All other companies should show as "Anonymous" (or similar)
Since RLS filters out other companies' data entirely at the model level, I created a duplicated fact table with no relationship to the RLS table, so all companies remain visible in this ranking view. This part works.
My problem: Since axis fields in a chart must be columns (not measures), I can't directly put an IF(company = current user's company, real name, "Anonymous") measure on the axis.
As a workaround, I tried showing a numeric/letter index/key on the axis, with a small separate table showing "which key = which company" for the logged-in user only. But my client finds this confusing and wants something simpler, ideally the real company name directly on the axis for their own company, and "Anonymous" for the rest.
Question: Is there a way to dynamically display the correct label (real name vs. "Anonymous") directly on a chart axis, based on USERPRINCIPALNAME(), without using a measure on the axis? Or is there a better pattern for this "self visible, others anonymized" ranking scenario?
I'm using DAX measures like:
'RLS_Firma'[E-Mail] = USERPRINCIPALNAME()
Any guidance on a cleaner approach (calculated column with row-level dynamic logic, field parameters, dynamic format strings, or a different table design) would be greatly appreciated.