Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
OrlandoChd
Frequent Visitor

RLS See all info for one Group or Vision

Hello,

I need help to figure how see all info in my database for the users listed as "administrador".

 

The problem is that "Administrador" are not an option in the fact table.

i try the following DAX code to create the Dynamic RLS but it doesn't work (the original file is in the link below)

https://github.com/MathiasChaparroItau/PBI-Files 

 

 

 

 

[VISION] = 
VAR _userp = USERPRINCIPALNAME()

VAR _vision = 
    CALCULATE( 
       MAX( 'RLS'[VISTA] ),
       FILTER( 'RLS', 
               'RLS'[CORREO] = _userp )
    )

RETURN
IF( _vision = "ADMINISTRADOR", 
    true(), _vision )

 

 

 

Part of the Fact Table

FECHADESCRIPCIONTIPOVISIONIMPORTE
31/10/2021GASTOS ADMINISTRATIVOSFIJOMARKETING220
31/10/2021EGRESOS EXTAORDINARIOSFIJOGERENTES243
31/10/2021EGRESOS EXTAORDINARIOSPROYECTOCUENTA NUEVA154
31/10/2021GASTOS ADMINISTRATIVOSFIJO 56
31/10/2021GASTOS ADMINISTRATIVOSFIJOMARKETING131

 

Table RLS

RESPONSABLEVISTAID PerfilCORREO
Mathias ChaparroADMINISTRADOR1 
Jose BenegasADMINISTRADOR1jose.benegas@mail.com.py
Sylvana ArecoADMINISTRADOR1Sylvana.areco@mail.com.py
Adriana LopezMARKETING2 
Alfredo PronoMARKETING2Alfredo.prono@mail.com.py
Andres CubasGERENTES3 
Andrea HelenoGERENTES3Andrea.heleno@mail.com.py
Jose CardenasGERENTES3Jose.cardenas@mail.com.py
Alejandro GonzalezCUENTA NUEVA4Alejandro.gonzalez@mail.com.py
Catalina ArecoCUENTA NUEVA4Catalina.areco@mail.com.py

 

I would appreciate your help with this problem. I thank you in advance!

3 REPLIES 3
OrlandoChd
Frequent Visitor

I changed the code a little to return true or false but I still can't get the "ADMINISTRADOR" to see all the rows.

Could someone help me please? I am not an expert and I would like to know if someone could help me

 

 

VAR _Admin = 
     IF( MAX('RLS'[VISTA]) ="ADMINISTRADOR", 
     1,
     0
     )

RETURN

IF (
    MAXX (
        FILTER ( 'RLS', 'RLS'[CORREO] = USERPRINCIPALNAME() ),
        _Admin )= 0,
    MAX('RLS'[CORREO]) = USERPRINCIPALNAME(),
    true
)

 

 

OrlandoChd
Frequent Visitor

Could someone guide me?

The RLS works with all the "VISTAS" except those of "ADMINISTRADOR" which are not found in the fact table

 

tks

lbendlin
Super User
Super User

the RLS rules need to return true or false, not strings.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.