cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gconnolljr Frequent Visitor
Frequent Visitor

Get drill down hierarchy level from Axis on column chart with DAX?

Does anyone know how to detect/get the current hierarchy level from “Axis” on a column chart?

 

For example, say I have a 4 column table with 10 records:

Column [National] with value of “All”

Column [State] with values “CO”, “TX” and “AZ”

Column [City] with 3 cities in CO, 3 cities in TX and 4 cities in AZ

Column [Count] with a numeric value, e.g. city population size

 

On the column chart, I set “Axis” as follows:

National

State

City

 

And I set “Value” as measure [Test], where [Test] is like this (pseudocode):

[Test] = if [current value of Axis] = “National” then [Measure A] else if [current value of Axis] = ”State” then [Measure B] else [Measure C]

...where Measures A, B and C are all different aggregations of [Count] using different modifications to filter context with CALCULATE.

 

Is there programmatic to detect with a DAX command the action of drill down from one level of the Axis hierarchy to another?

 

1 ACCEPTED SOLUTION

Accepted Solutions
gconnolljr Frequent Visitor
Frequent Visitor

Re: Get drill down hierarchy level from Axis on column chart with DAX?

Makes sense. Thank you very much for your help Qiuyun Yu.

4 REPLIES 4
Moderator v-qiuyu-msft
Moderator

Re: Get drill down hierarchy level from Axis on column chart with DAX?

Hi @gconnolljr,

 

You can create a measure use IsFiltered() function and put it as the chart value (In your scenario, you can replace 1 as Measure A, 2 as Measure B, 3 as Measure C): 

 

Measure = IF(ISFILTERED('Table2'[National]),1,IF(ISFILTERED(Table2[State]),2,IF(ISFILTERED(Table2[City]),3,BLANK())))

 

z1.PNGz2.PNGz3.PNG

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
gconnolljr Frequent Visitor
Frequent Visitor

Re: Get drill down hierarchy level from Axis on column chart with DAX?

That's pretty slick...thank you!

 

I can see it working when I choose to "Go to next level in the hiearchy", but not if I try to "Expand to next level in the hiearchy".  Got any magic for that, too?

Moderator v-qiuyu-msft
Moderator

Re: Get drill down hierarchy level from Axis on column chart with DAX?

Hi @gconnolljr,

 

If current level is National, use "Expand to next level in the hierarchy" action will have National and State both be filtered, so the previous measure doesn't work. You can create a measure below: 

 

ExpandNextLevel = IF(ISFILTERED(Table1[National]) && ISFILTERED(Table1[State]) && ISFILTERED(Table1[City]),3,IF(ISFILTERED(Table1[National]) && ISFILTERED(Table1[State]),2,IF(ISFILTERED(Table1[National]),1,BLANK())))

 

Please note this measure will not work when use "Go to next level in the hierarchy". We can't catch the current level use one measure for both "Go to next level in the hierarchy" and "Expand to next level in the hierarchy". 

 

Best Regards,
Qiuyun Yu 

 

 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
gconnolljr Frequent Visitor
Frequent Visitor

Re: Get drill down hierarchy level from Axis on column chart with DAX?

Makes sense. Thank you very much for your help Qiuyun Yu.