Using ISSELECTEDMEASURE to navigate to two different drill through pages

Hi, I have a main page for the report and two for drillthrough. I am using the following measure on the action of a button to navigate to different drill through pages if I select a visual with one measure or if I select another measure on another visual.

Drillthrough filter = var page4 = ISSELECTEDMEASURE([Total Open Risks], [Mitigated Risks])

var result = IF(page4,“Page 4”, “Page 5”) return result

What happens is that it works with only one measure, enabling the drillthrough to only one page. For example if I select the visual with the “Mitigated Risk” measure, it brings me to Page 5. If I select “Total Open Risks” the button to drill through stays disabled.

I have also tried the following:

Drillthrough filter = IF( ISSELECTEDMEASURE([Total Open Risks])," Page 4", “Page 5”)

The output is the same, it navigates to Page 5 if I select the visual with the measure “Mitigated Risks”, if I select “Total Open Risks”, the button stays disabled.

Another solution I have tried is:

Drillthrough filter = IF( ISSELECTEDMEASURE([Total Open Risks]), IF(ISSELECTEDMEASURE([Mitigated Risks])," Page 5"), “Page 4”)

What happens is that if I select “Total Open Risks”, the buttonenables and I can drill through to Page 4, if I select “Mitigated Risks”, the button enables, but it brings me to Page 4 instead of Page 5.

I have also used the following:

switch = SWITCH(TRUE(), ISSELECTEDMEASURE([Total Open Risks]), “Page 4”, ISSELECTEDMEASURE([Mitigated Risks]), “Page 5”, “”)

This measure won’t enabled the button for drill through with both measure.

Any help on how to make this measure work properly is really appreaciated.

I use two simple bar charts with Owner on the X axes and on the Y axes one of the two measures below.

Mitigated Risks = CALCULATE(COUNT(‘Risk’[Mitigated]),‘Risk’[Mitigated]=“Mitigated”, USERELATIONSHIP(‘Calendar’[Date],‘Risk’[Mitigation Date]))+0

Open Risks = CALCULATE(COUNTx(FILTER(‘Risk’,‘Risk’[Creation Date]<= max(‘Calendar’[Date]) && (ISBLANK(‘Risk’[Mitigation Date]) || ‘Risk’[Mitigation Date]> max(‘Calendar’[Date]))),[Risk ID]),CROSSFILTER(‘Calendar’[Date],‘Risk’[Creation Date],None))

Risk id Owner Creation Date Mitigation Date Mitigated description
1 owner 1 30/06/2022 31/12/2022 Mitigated descr1
2 owner 2 30/06/2022 Open descr2
3 owner 3 30/06/2022 31/12/2022 Mitigated descr3
4 owner 4 31/12/2022 30/06/2023 Mitigated descr4
5 owner 5 31/12/2022 30/06/2023 Mitigated descr5
6 owner 6 31/12/2022 Open descr6
7 owner 7 31/12/2022 Open descr7
8 owner 8 30/06/2023 Open descr8