Forum Discussion
dlagos
1 year agoRegular Visitor
Filter Dinamic for USER
I have this dax but don´t work by user... how can a fix this?? MEASURE '02-Cal Real'[01-Real Dinamico] = VAR Real = '02-Cal Real'[01-Real] VAR Usuario = USERPRINCIPALNAME() VAR Us...
rajendraongole1
Super User
1 year agoHi dlagos - Improvised measure as below:
MEASURE '02-Cal Real'[01-Real Dinamico] =
VAR Real = '02-Cal Real'[01-Real]
VAR Usuario = USERPRINCIPALNAME()
-- Filter the Maestro RLS table to get the current user's row
VAR UsuarioActual = FILTER('Maestro RLS', 'Maestro RLS'[Correo electrónico] = Usuario)
-- Get the list of CC values for the current user
VAR CCActual = SELECTCOLUMNS(UsuarioActual, "@CC", 'Maestro RLS'[CC])
-- Check if CCActual has values and apply the filter dynamically
RETURN
IF (
ISBLANK(CCActual),
BLANK(),
CALCULATE(
Real,
'Centro de Costo'[DEPENDENCIA (Oracle)] IN VALUES(CCActual[@CC])
)
)
Ensure that row-level security (RLS) is properly configured in Power BI and the Maestro RLS table is included in the model.
Hope this helps.