Forum Discussion

nok's avatar
nok
Icon for Advocate II rankAdvocate II
1 year ago
Solved

X-axis variable according to Drill Down

Hello!

I'm trying to create a conditional x-axis on my chart that changes according to the Drill Down performed by the user on the chart. This Drill Down is based on a hierarchy that I created between two text columns in my table (Category column -> ID column).

Basically, when the Y-axis of my chart is showing the column "Category", the measure of the X-axis should show the count of distinct rows in my table. When the user performs the Drill Down on the chart and the Y-axis starts showing each "ID", the measure of the X-axis should show the sum of the values ​​of the "Hours" column.

To do this, I created the measure below for the X-axis:

IF(ISFILTERED(MyTable[Category]),
        SUM(MyTable[Hours]),
        DISTINCTCOUNT(MyTable[Id])
    )

 

However, this measure always falls into the True condition, even when the Drill Down is not performed on my chart. It always shows only the sum of the "Hours" column. Is there any way to do this?

  • You can try ISINSCOPE.

    Measure = 
    IF(
        ISINSCOPE('Table'[ID]),
        [Hours Sum],
        [Distinct]
    )

    You would need to test for the lowest level in the hierarchy first.
    If you have multiple levels you can replace the IF with a SWITCH.

1 Reply

  • You can try ISINSCOPE.

    Measure = 
    IF(
        ISINSCOPE('Table'[ID]),
        [Hours Sum],
        [Distinct]
    )

    You would need to test for the lowest level in the hierarchy first.
    If you have multiple levels you can replace the IF with a SWITCH.