Forum Discussion

Lexi_Liu's avatar
Lexi_Liu
Frequent Visitor
3 years ago

Dax Measure based on if Dynamic RLS is applied

Hi,

I have set up several security roles and one of them is a dynamic role by using [user email]= userprincipalname()

Is there a way we can add condition on a dax measure, if that dynamic role is applied (someone from the dynamic role list accessed report), show [measure 1], otherwise show [measure 2] ?

Thanks a lot!

Best Regards

4 Replies

  • eliasayyy's avatar
    eliasayyy
    Memorable Member

    Hello Lexi_Liu its possible based on what i understood from yoir description but i need more information to be able to help you out please

    • Lexi_Liu's avatar
      Lexi_Liu
      Frequent Visitor

      Thanks for your response. So basically I have two DAX measure in my reports and their calculation is different. I want to have a new DAX with condition, let's say if someone from the Dynamic User List accessed the report, they will see the first type of calculation, but other user (or by default) will see the second type of calculation.

      Something like: [Condition]=calculate(if(User is from Dynamic Role), [Measure1], [Measure2])

       

      I learnt from another post that looks similar to my question and it looks we cannot make it because "RLS is applied at the dataset level, the measure is created inside the dataset."☹️

      https://community.fabric.microsoft.com/t5/Desktop/Is-there-a-way-to-tell-if-RLS-is-filtering-a-table-using-dax/m-p/708374/highlight/true#M342031

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Lexi_Liu ,

     

    As far as I know, you can configure multiple roles for different conditions. Then add the users into different roles after you publish to Power BI Service.

    For example, in my sample I create two roles for different condtions in Power BI Desktop.

    Publish to Power BI Service > Dataset>Security>Add Roles

     

    Best Regards,
    Rico Zhou

     

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

     

    • Lexi_Liu's avatar
      Lexi_Liu
      Frequent Visitor

      Hi Rico, this may not what I'm looking for but thanks a lot for your help!