1 2 Previous Next 16 Replies Latest reply on Oct 17, 2018 9:02 AM by sulai man

# How to do Row Level Security with multiple dimensions using OR

Hi all,

I'm stumped with RLS. I've successfully implemented it based on a single dimension. If you're this user and you have privileges on a dimension, you can see that data. No problem.

But I have multiple dimensions, and I need it to be an OR situation.

For example, show the user all data where he matches Dimension 1, Dimension 2, or Dimension 3. My current security table stops after Dimension 1.

Column A is my user, and Columns B, C, D, are my three dimensions. And my calculation is simply USERNAME()=[User]

I think I need a different calculation column to help me, but I can't figure out what that calculation should be. Any help is much appreciated.

Thank you!

What my security table looks like, below. I want Mike to see anything in Michigan, with Mary as an Assistant, or in Tier A. I think I have this part right, it's just my calculation that has issues. It's currently showing Mike everything in Michigan, but not where Mary is the Assistant or where the client is Tier A, unless they also happen to be in Michigan.

• ###### 1. Re: How to do Row Level Security with multiple dimensions using OR

First of all you need to combine your fact table with security table above like (already DONE ??)

User        State        Assistant(fact)        Tier        Tier (Security Table)         Assistant (Security table)

After that below Calc

If username()=user( ) and ( Assistant(Fact table)=Assistant (security table )  or Tier(Fact table)=Tier (security table) )

then 1 else 0 end

Thanks,

Ritesh

• ###### 2. Re: How to do Row Level Security with multiple dimensions using OR

Thank you!! I'm getting closer. Why did you leave out State from the calculation? Is it not needed?

Reading your response, I think I've done my Join incorrectly. I joined my fact table to my security table using the first dimension - if I try to join it using the other dimensions as well, my security calculation only gives me FALSE (0) as a filter option. When I only join the first dimension, I get TRUE (1) as a filter option, but it stops looking after that dimension. I am using the left join (I watched your You Tube video yesterday afternoon).

Thanks!

1 of 1 people found this helpful
• ###### 3. Re: How to do Row Level Security with multiple dimensions using OR

I've figured out that if I join a second dimension, it treats it as an AND. So if I join State and Assistant, it will only show Mike everything where it's Michigan AND Mary, even though my calculation clearly has Username AND (State OR Assistant OR Tier). Not sure what I'm doing wrong.

• ###### 4. Re: How to do Row Level Security with multiple dimensions using OR

Hi Caite,

I will come back to you on this

Thanks,

Ritesh

• ###### 5. Re: How to do Row Level Security with multiple dimensions using OR

Hi Caite ,

I got your point and have tried to solve this with the help of Tableau prep

Our need is to Join separately and then do Union

Join 1 is with Assistant

Join 2 is with Tier (I am not considering State for now )

Below is my security table (I am ribisht)

Below is the fact table

So, I should be able to see (yellow highlighted rows )

Tableau prep helped me

to get data-source like below

In order to avoid duplicate rows sales sum  I used (you may have common rows from join 1 & 2 ) ---->

Now it is easy for me to use [User]=USERNAME()

And I can see my relevant details

Hope it helps ! Do you know how to use Prep , its easy ,I started today only with your example

Thanks,

Ritesh

• ###### 7. Re: How to do Row Level Security with multiple dimensions using OR

Thanks,

Ritesh

• ###### 8. Re: How to do Row Level Security with multiple dimensions using OR

Hi Caite,

Following up

Did you get change to check.

Thanks,

Ritesh

• ###### 9. Re: How to do Row Level Security with multiple dimensions using OR

Hi Caite,

Following up

Did you get change to check.

Thanks,

Ritesh

• ###### 10. Re: How to do Row Level Security with multiple dimensions using OR

Hi Ritesh,

I ended up getting lost in the instructions and couldn’t replicate what you had done.

• ###### 11. Re: How to do Row Level Security with multiple dimensions using OR

Did you watch the Video above ? That might have helped

Thanks,

Ritesh

• ###### 12. Re: How to do Row Level Security with multiple dimensions using OR

Hi Ritesh Bisht. I have an issue similar to the one you had discussed in the video and forum. I have implemented Security by merging fact table with security table. when publishing the workbook, i have an option "Generate thumbnails as User" . Should i select my user name when publishing ? . I want this Dashboard to be viewed by different users and based on the userid, the user will be able to see the data which he is authorised to. Please advice how to achieve the solution i intend to.

• ###### 13. Re: How to do Row Level Security with multiple dimensions using OR

Please try below and let me know