Suppose you are considering sharing your Power BI content and need to restrict the views of some users and give the view of some users. Then, it is possible to achieve Row-Level Security (RLS) by using DAX in power bi. The following procedure summarises this.
Establish Roles: First, open the Power BI Desktop. On the Menu bar, click on "Modeling" and then click "Manage Roles." There, you can set up roles according to the users' needs. For instance, you can designate roles such as 'Sales' or 'HR' for various departments.
Add Filters with DAX: After setting up a role, the next step is to set up DAX expressions to filter out the data that should not be visible to the user. For instance, if the user needs to be filtered out to see data pertaining to a specific region, one can use a DAX filter like [Region] = "East." This ensures that the user assigned the "East" region role does not have access to any data except for that which pertains to that specific Region, and the data is filtered accordingly.
Assign Roles in Power BI Service: Once these roles and DAX filters have been created in the Power BI Desktop, the report can be published to Power BI Service. In this case, you can assign users to these roles by accessing the dataset settings in the service, clicking on 'Security,' and then adding users to the relevant roles.
This method achieves the result that ever the user sees only the data that he is allowed to visit according to the RLS implementations using DAX.