Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gconnolljr
New Member

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

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

View solution in original post

4 REPLIES 4
v-qiuyu-msft
Community Support
Community Support

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.

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?

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.

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors