Forum Discussion
Filter table based on current user details
- Anonymous2 years ago
Hi Sumanth327 ,
Sorry for being late! Back to work.
Assuming you already have a measure dedicated to getting Dept Code, we can change DAX to:Measure = VAR _Current_User_Lab = [Current User Lab] VAR _Current_Dept_Code = [Dept Code] RETURN IF( _Current_Dept_Code <> 2132, IF( MAX('Table'[TrimmedDeptCreatedBy]) = _Current_User_Lab || MAX('Table'[TrimmedDeptProjLeader]) = _Current_User_Lab || MAX('Table'[TrimmedDeptTestResponsible]) = _Current_User_Lab, 1, 0 ), 1 )Here I am defaulting to 2132 as a numeric type, if you are using a text type, please change it to “2132”.
The final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous , Thank you so much for the help.
Can you help me with this additional condition also which I got to know today. i.e.,
If the Dept Code measure is equal to 2132 then no filterings has to be applied i.e., show all the items without conditions you have suggested above.
If the Dept Code measure is not equal to 2132 then all the logic you have suggested has to be applied.
Hi Sumanth327 ,
Sorry for being late! Back to work.
Assuming you already have a measure dedicated to getting Dept Code, we can change DAX to:
Measure =
VAR _Current_User_Lab = [Current User Lab]
VAR _Current_Dept_Code = [Dept Code]
RETURN
IF(
_Current_Dept_Code <> 2132,
IF(
MAX('Table'[TrimmedDeptCreatedBy]) = _Current_User_Lab || MAX('Table'[TrimmedDeptProjLeader]) = _Current_User_Lab || MAX('Table'[TrimmedDeptTestResponsible]) = _Current_User_Lab,
1,
0
),
1
)
Here I am defaulting to 2132 as a numeric type, if you are using a text type, please change it to “2132”.
The final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.