cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Post Patron

## DAX Formula for Drilling Down to the Min Value and maintain Level Hierarchy

I'd like to show a minimum value relationship per part.

The data I'm working with has a four level data hierachy per group.
Starting with the Group Name.

I need the min value down to the lowest hiercharchy per group pre exercise.

The group is then exercised.
I need the min value down to the lowest hiercharchy per group post exercise.

I take the delta between pre and post exercise:  Delta = min(table[Pre Value]) - min(table[PostValue])

The problem arises is when I want to show this in a regular table.  I have to add the columns of each data level in the hierarchy to show the smallest and largest delta.  I don't want to show all the levels in the hierachy in the table.

Basically show Group Name and Largest Delta and Smallest Delta.

I need a measure that will maintain the data hierachry down to the lowest level.

This is the only way I know how to get this to work.  Is to reveal each data level in the hiearchy.  (Drill Down)
This measure works fine with the table below, but shows way too much unwanted information.
Delta = min(table[Pre Value]) - min(table[PostValue])

 Device Level1 Level2 Level3 Level4 Pre Value PostValue Delta A 0 0 0 0 1000 1050 -50 A 0 1 0 1 999 899 100 A 1 0 0 0 1010 1000 10 A 1 1 0 1 800 770 30 B 0 0 0 0 900 925 -25 B 0 1 0 1 750 800 -50 B 1 0 0 0 800 750 50 B 1 1 0 1 575 550 25

What I need is a measure to condense and not show each level but maintain the hiearchy to the lowest level.
I do not know how to maintain or force hierchy level down to the lowest level using DAX.

This is what I need ideally with Min Delta and Max Delta as separate measures.
That way I can show both min or max Delta, or both.

 Device Level1 Level2 Level3 Level4 PreValue PostValue Delta Type Delta A 0 0 0 0 1000 1050 min -50 A 0 1 0 1 999 899 max 100 B 0 1 0 1 750 800 min -50 B 1 0 0 0 800 750 max 50

I would settle for the table below if it's any easier.

 Device Delta Min Delta Max A -50 100 B -50 50

Note:
PreValue is a measure.
PostValue is a measure

I've tried many DAX functions.  Using All, All Except, All Selected, Filter and some combination thereof as well as other functions.

I need help from the experts.

Thank You.

3 REPLIES 3
Community Support

Hi @roncruiser ,

Is this what you want? Please check the attached .pbix file.

``````Filter Measure =
VAR MIN_ =
MINX ( ALLEXCEPT ( 'Table', 'Table'[Device] ), [Delta Measure] )
VAR MAX_ =
MAXX ( ALLEXCEPT ( 'Table', 'Table'[Device] ), [Delta Measure] )
RETURN
IF ( [Delta Measure] = MIN_ || [Delta Measure] = MAX_, 1 )
``````
``````Delta Max =
MAXX ( ALLEXCEPT ( 'Table', 'Table'[Device] ), [Delta Measure] )``````
``````Delta Min =
MINX ( ALLEXCEPT ( 'Table', 'Table'[Device] ), [Delta Measure] )``````

Best Regards,

Icey

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Post Patron

Hi @Icey

I am looking at it now and trying to understand the logic behind your DAX measures and how it all works together.  The data I posted in this thread is a basic format example of the real data but not the real data.   The acutal data set is millions of rows deep.   I will apply your measures to the real data and I will respond soon.

Thank You for taking the time @Icey

Post Patron

I would like like some help.  Anyone care to chime in to at least discuss will be appreciated.
I was thinking maybe a helper table to begin with?  Maybe a helper table is not needed.  I am unsure.
Hope to hear from the forum.

Thank You.

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

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

#### Fabric Community Update - August 2024

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

Top Solution Authors
Top Kudoed Authors