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...
Anonymous
1 year agoNot applicable
Hi dlagos
It looks like there are a few issues with the DAX code you provided. Here are some steps you can take to fix it:
Wrap USERPRINCIPALNAME() in a CALCULATE function, this ensures that the function is used within a row context. Use CALCULATETABLE for FILTER and SELECTCOLUMNS, this helps create a row context for these functions. Ensure the IN operator is used within a CALCULATE function, this also helps create a row context.
MEASURE '02-Cal Real'[01-Real Dinamico] =
VAR Real = '02-Cal Real'[01-Real]
VAR Usuario = CALCULATE(USERPRINCIPALNAME())
VAR UsuarioActual = CALCULATETABLE(
FILTER('Maestro RLS', 'Maestro RLS'[Correo electrónico] = Usuario)
)
VAR CCActual = CALCULATETABLE(
SELECTCOLUMNS(UsuarioActual, "@CC", 'Maestro RLS'[CC])
)
RETURN
CALCULATE(Real, 'Centro de Costo'[DEPENDENCIA (Oracle)] IN CCActual)
EVALUATE
SUMMARIZECOLUMNS(
'01-Calendario'[Año],
'01-Calendario'[Nombre Corto Mes],
'Centro de Costo'[DEPENDENCIA (Oracle)],
"01-Real", '02-Cal Real'[01-Real Dinamico]
)
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- dlagos1 year agoRegular Visitor
it doesn't work, but is really good idea