cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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.

View solution in original post

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.

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 189 members 2,155 guests
Please welcome our newest community members: