当前位置:网站首页>Bi skills - authority control

Bi skills - authority control

2022-06-23 03:10:00 Powerbi white tea

BI Visualization in the implementation process , What are the most concerned points of users ?

I believe many of my friends have encountered this problem , Or asked by others , White tea summarizes some points that users care about : Security 、 Self help 、 Authority control 、 Ease of use 、 Compatibility 、 Extensibility 、 convenience 、 Reaction speed, etc .

What about this issue , Let's talk about permission control .

PowerBI So far , The permission control that can be realized includes three aspects : Page permissions 、 Line authority 、 Column permissions .

So these three are PowerBI How is China realized ? Don't worry. , Follow the idea of white tea .

Let's take a look at the case data in this issue :

The case data is not very complex , There are three tables in total , They are the permission table 、 Country tables and case data .

Import it into PowerBI in , Let's simply handle the permission table .

This is PowerQuery Screenshot of permission table in , You can see that page permissions and country permissions are stored in a comma separated manner .

We need to split these two columns .

choice “ Page permissions ”, choice “ Split column ”, Select press “ Separator split ”.

choice “ Custom delimiter ”, Enter the space between text , Choose advanced options , Select split into “ That's ok ”.

give the result as follows :

Empathy , According to the above operation , We will “ Line authority ” To break up .

The advantage of doing so is , After the report is officially put into use , Users only need to maintain Excel Permission configuration in file ,PowerBI Will automatically split in the background , Perform report permission control .

Select close and apply , The model is shown in the following figure. .

Notice here , Permission tables do not need to establish model relationships with other tables .

White tea according to case data , I simply made the following statements .

home page : Used as page permission control , The use field is the page permission field in the permission table .

Visualization page : Used to display column permissions .

Details page and map page : Show page permission and row permission usage .

Come here , Our preparations have been basically completed , Let's take a look , Three in PowerBI How to implement in .

Page permissions :

1. Report page naming and hiding .

Here we need to pay attention to , Name of the report page , Be sure to make contact with Excel The text in corresponds to , Otherwise, the navigation will fail .

When we're done configuring , Pages other than the home page , All should be set to hide ; When publishing, the page should stay on the home page .

2. Page permission configuration : choice “ Management roles ”, Choose to create a role “ Page permissions ”, stay “ Permissions on the table ” Enter the following code .

[ mailbox ]=USERNAME()

3. Page setup : The slicer field selects... In the permission table “ Page permissions ” Field .

Add the following measures :

 Page selection  =
SELECTEDVALUE ( ' Permissions on the table '[ Page permissions ] )

Add a button , stay “ operation ” The type selected in the setting is “ Page navigation ”, Click on “fx” Button , The selected field value is “ Page selection ”.

Come here , Page permission configuration is complete , Let's click... On the panel “ View as ”.

For other users, we can enter the user's email to test .

We type in BB Test it :

You can see , When we type in BB In the mailbox , The slicer will automatically filter the page according to the user's permission .

Line authority (RLS):

Row permissions often represent the data range that users can see .

1. Add the following measures :

 State authority  =
VAR CountryAccess =
CALCULATETABLE ( VALUES ( ' Permissions on the table '[ Line authority ] ), ' Permissions on the table '[ mailbox ] = USERNAME () )
RETURN
SELECTEDVALUE ( ' Country table '[CountryZH] ) IN CountryAccess

2. Add a new role in the management role page as follows .

The code is as follows :

[ State authority ]=True()

So we can see the data range , It will be filtered according to the user's permissions .

Let's have a simple view on the report page .

Column permissions (OLS):

Column permission control , It usually means that the user can see different columns .

stay PowerBI in , There are two ways to do it :A.Tabular Editor The way .B.DAX The way .

These two ways ,A In fact, white tea is not recommended for everyone to use .

for instance :Tabular Editor You can control whether a physical column is displayed according to user permissions , So this column , In the process of making reports , You need to use it with caution , Once used , When some users without permission open the report , Some visual charts on the report page will report errors , This is for the user experience , Very bad .

B The way , White tea is recommended for you , Write column permissions into DAX in , It's more flexible .

Simulation scenario :

If the user is “ management layer ”, The chart shows “Budget” data , If the user is “ Executive ”, The chart shows “Amount” data .

Write as follows DAX:

 Column permissions  =
VAR RoleAccess =
CALCULATETABLE ( VALUES ( ' Permissions on the table '[ role ] ), ' Permissions on the table '[ mailbox ] = USERNAME () )
RETURN
IF ( RoleAccess = " management layer ", SUM ( ' Case data '[Budget] ), SUM ( ' Case data '[Amount] ) )

Put it into the visualization , Let's take a look at the effect .

DAX How to control column permissions , The best practice is to work with SSAS Use it with , This can be done in Tabular Hide columns , Present only DAX To the user , Achieve real OLS Control and control .

matters needing attention :

1. Permission control can be deployed locally and in the cloud Servers Use , The free version of this machine can only be viewed through roles .

2. On the cloud Servers The minimum license for use needs to be Pro account number .

3. On the cloud Servers You need to add the shared user to the corresponding workspace , Permission is “ viewer ”. And need to be in the same organization .

4. Data set security needs to be set , Add the user mailbox to the role .

( White tea : Documents on the planet of knowledge )

This is white tea , One PowerBI Beginners .

原网站

版权声明
本文为[Powerbi white tea]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/01/202201221420271448.html