Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Conditional RLS DAX

I read dozens of articles about RLS but it seems that none of them works for my case. I am sure that the solution should be simple, I just can’t find it somehow…   I have a table ‘Tariff’ (with tho...
  • v-chenwuz-msft's avatar
    4 years ago

    Hi Anonymous ,

     

    Two ways.

     

    1 add one more row to user table.

    Then RLS filter DAX:

    User:
    [UserEmail] = username() || [UserEmail] = "all"
    
    TARIFF:
    [ConsignorID] = "00000"
    ||
    [ConsignorID] in values('User'[ConsignorID])

     

    Result:

     

    2 Detele the relationship between these two tables and RLS Filter DAX:

     

    User:
    [UserEmail] = username()
    
    TARIFF:
    [ConsignorID] = "00000"
    ||
    [ConsignorID] in calculatetable(values('User'[ConsignorID]),filter('User',[UserEmail] = username()))
    

     

    Result:

     

    Pbix in the end you can refer.

    Best Regards

    Community Support Team _ chenwu zhu

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.