Forum Discussion
Conditionally Filter Specific Visuals Based on Current User Logged In
- 1 year ago
You can't use VALUES on its own, as the CSR table is being filtered by having the CSR name in the slicer or table visual. I think the below works, using REMOVEFILTERS
02 Should Current User Be Filtered = VAR CSRFilterEmailList = //ONLY NON-MANAGER CSR'S SHOULD HAVE DATA FILTERED CALCULATETABLE( VALUES('Dim CSR'[Email]), 'Dim CSR'[IsManager] = 0, REMOVEFILTERS( 'Dim CSR'[Name] ) ) VAR CurrentUser = [01 Current User] VAR ShouldCurrentUserBeFiltered = //VERIFY IF CURRENT USER LOGGED IN IS A NON-MANAGING CSR. //IF YES THEN WE NEED TO FILTER CSR SLICER & CSR TABLE VISUALS BY CURRENT USER LOGGED IN //IF NO THEN DO NOTHING. I.E. DO NOT FILTER THESE VISUALS BY THE CURRENT USER LOGGED IN IF( CONTAINS(CSRFilterEmailList, 'Dim CSR'[Email], CurrentUser), 1, 0 ) RETURN ShouldCurrentUserBeFiltered
Hi WinterMist
Please try the following possible solution:
1. Modify your Count measures with the following DAX
(This also applies to [02 Count In Progress] and [03 Count Complete], simply change 'New' to 'In Progress' or 'Complete'. )
01 Count New =
IF(
[02 Should Current User Be Filtered] = 1,
CALCULATE(
COUNTROWS('Fact Documents'),
'Fact Documents'[Status] = "New",
FILTER(
'Dim CSR',
'Dim CSR'[Email] = [01 Current User]
)
),
CALCULATE(
COUNTROWS('Fact Documents'),
'Fact Documents'[Status] = "New"
)
)
2. Create the following measure and drag it into the Filter panel of the CSR filter, setting the filter condition to 'is not blank'.
Filtered CSR =
IF (
[02 Should Current User Be Filtered] = 1,
[01 Current User],
BLANK()
)
3. Replace the 'Dim CSR'[Name] field in the CSR Summary Table visual with 'Fact Documents'[CSRID].
The test results are as follows:
When user [email protected] accesses this report:
When user [email protected] accesses this report:
Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.