Forum Discussion
Drill through excluding specific record
- 2 months ago
Hi Jensman
Yes, this is possible, but I would not try to solve it with drill-through filters only.
The drill-through should mainly be used to pass the selected row context from visual 1. Then, on visual 2, use a measure to decide which rows should remain visible.
In your case, the logic should be:
```text
Column1 + Column2 must match the selected row from visual 1
but
Column1 + Column2 + Column3 must not be exactly the same record
```One possible approach is to create two key columns in both tables:
```DAX
Key_12 =
COMBINEVALUES(
"|",
'Table'[Column1],
'Table'[Column2]
)
``````DAX
Key_123 =
COMBINEVALUES(
"|",
'Table'[Column1],
'Table'[Column2],
'Table'[Column3]
)
```Then create a measure for visual 2:
```DAX
Show in Visual 2 =
VAR SelectedKey12 =
SELECTEDVALUE ( 'Table1'[Key_12] )VAR SelectedFullKey =
SELECTEDVALUE ( 'Table1'[Key_123] )VAR CurrentKey12 =
SELECTEDVALUE ( 'Table2'[Key_12] )VAR CurrentFullKey =
SELECTEDVALUE ( 'Table2'[Key_123] )RETURN
IF (
NOT ISBLANK ( SelectedKey12 )
&& CurrentKey12 = SelectedKey12
&& CurrentFullKey <> SelectedFullKey,
1,
0
)
```Add this measure to the visual-level filters of visual 2 and set it to:
```text
Show in Visual 2 is 1
```The important point is to make sure that `Column3` or `Key_123` is not directly filtering visual 2 through the drill-through/page filters. If Power BI already filters visual 2 down to the exact full record before the measure is evaluated, the measure will not be able to bring back the other matching rows.
So the safer setup is:
* use drill-through only to pass the selected row context from Table1
* compare `Column1 + Column2` in the measure
* exclude the exact same `Column1 + Column2 + Column3` combination in the measure
* avoid applying `Column3` as a direct drill-through filter on Table2If this still does not work as expected, please share a small sample PBIX or a simplified model with dummy/non-sensitive data. The important part would be to include the two tables, columns 1–3, the current relationships, the drill-through setup, and one example of the expected output for a selected row. With that, it would be much easier to suggest the exact DAX/model setup.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Hi Jensman
Yes, this is possible, but I would not try to solve it with drill-through filters only.
The drill-through should mainly be used to pass the selected row context from visual 1. Then, on visual 2, use a measure to decide which rows should remain visible.
In your case, the logic should be:
```text
Column1 + Column2 must match the selected row from visual 1
but
Column1 + Column2 + Column3 must not be exactly the same record
```
One possible approach is to create two key columns in both tables:
```DAX
Key_12 =
COMBINEVALUES(
"|",
'Table'[Column1],
'Table'[Column2]
)
```
```DAX
Key_123 =
COMBINEVALUES(
"|",
'Table'[Column1],
'Table'[Column2],
'Table'[Column3]
)
```
Then create a measure for visual 2:
```DAX
Show in Visual 2 =
VAR SelectedKey12 =
SELECTEDVALUE ( 'Table1'[Key_12] )
VAR SelectedFullKey =
SELECTEDVALUE ( 'Table1'[Key_123] )
VAR CurrentKey12 =
SELECTEDVALUE ( 'Table2'[Key_12] )
VAR CurrentFullKey =
SELECTEDVALUE ( 'Table2'[Key_123] )
RETURN
IF (
NOT ISBLANK ( SelectedKey12 )
&& CurrentKey12 = SelectedKey12
&& CurrentFullKey <> SelectedFullKey,
1,
0
)
```
Add this measure to the visual-level filters of visual 2 and set it to:
```text
Show in Visual 2 is 1
```
The important point is to make sure that `Column3` or `Key_123` is not directly filtering visual 2 through the drill-through/page filters. If Power BI already filters visual 2 down to the exact full record before the measure is evaluated, the measure will not be able to bring back the other matching rows.
So the safer setup is:
* use drill-through only to pass the selected row context from Table1
* compare `Column1 + Column2` in the measure
* exclude the exact same `Column1 + Column2 + Column3` combination in the measure
* avoid applying `Column3` as a direct drill-through filter on Table2
If this still does not work as expected, please share a small sample PBIX or a simplified model with dummy/non-sensitive data. The important part would be to include the two tables, columns 1–3, the current relationships, the drill-through setup, and one example of the expected output for a selected row. With that, it would be much easier to suggest the exact DAX/model setup.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Thanks for the solution, this seems to do what I was looking for!