Forum Discussion
Filtering issue
- Anonymous4 years ago
Hi PowerBIOrg ,
Here's my solution.
1.Create a calculated table to get the unique Patient ID for the slicer.
Table 2 = DISTINCT('Table'[PatientID])2.Create another table with the following two values for the slicer too by entering data.
3.There're no relationships among tables.
4.Create a measure as a visual level filter.
Measure = SWITCH ( SELECTEDVALUE ( 'Table 3'[Type] ), "Included Dependent", IF ( CALCULATE ( MAX ( 'Table'[EmployeeID] ), FILTER ( ALLSELECTED ( 'Table' ), [EmployeeID] = MAX ( 'Table'[EmployeeID] ) && [PatientID] IN ALLSELECTED ( 'Table 2'[PatientID] ) ) ) = MAX ( 'Table'[EmployeeID] ), 1 ), "Not Included Dependent", IF ( CALCULATE ( MAX ( 'Table'[PatientID] ), FILTER ( ALLSELECTED ( 'Table' ), [EmployeeID] = MAX ( 'Table'[EmployeeID] ) && [PatientID] IN ALLSELECTED ( 'Table 2'[PatientID] ) ) ) = MAX ( 'Table'[PatientID] ), 1 ) )5.Create two slicers, a table visual as follows.
6.Put the measure into the table visual level filters, set show items when the value is 1.
Now, when you select 'Included Dependent', 'A0' and 'B0', the result is below.
When you select 'Not Included Dependent', 'A0' and 'B0', the result is below.
You can check more details from my attachment.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi PowerBIOrg ,
Here's my solution.
1.Create a calculated table to get the unique Patient ID for the slicer.
Table 2 = DISTINCT('Table'[PatientID])
2.Create another table with the following two values for the slicer too by entering data.
3.There're no relationships among tables.
4.Create a measure as a visual level filter.
Measure =
SWITCH (
SELECTEDVALUE ( 'Table 3'[Type] ),
"Included Dependent",
IF (
CALCULATE (
MAX ( 'Table'[EmployeeID] ),
FILTER (
ALLSELECTED ( 'Table' ),
[EmployeeID] = MAX ( 'Table'[EmployeeID] )
&& [PatientID] IN ALLSELECTED ( 'Table 2'[PatientID] )
)
)
= MAX ( 'Table'[EmployeeID] ),
1
),
"Not Included Dependent",
IF (
CALCULATE (
MAX ( 'Table'[PatientID] ),
FILTER (
ALLSELECTED ( 'Table' ),
[EmployeeID] = MAX ( 'Table'[EmployeeID] )
&& [PatientID] IN ALLSELECTED ( 'Table 2'[PatientID] )
)
)
= MAX ( 'Table'[PatientID] ),
1
)
)
5.Create two slicers, a table visual as follows.
6.Put the measure into the table visual level filters, set show items when the value is 1.
Now, when you select 'Included Dependent', 'A0' and 'B0', the result is below.
When you select 'Not Included Dependent', 'A0' and 'B0', the result is below.
You can check more details from my attachment.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks Stephen!
Though it didn't meet my desired output for "Not Included Dependent" part, so I modified the query as following:
IF (
CALCULATE(MAX('Table'[PatientID]),
FILTER ('Table', [PatientID] IN ALLSELECTED ( 'Table 2'[PatientID] ) ) )
= MAX ( 'Table'[PatientID] ),
1
)