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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
roncruiser
Post Patron
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

Level1Level2Level3Level4Pre ValuePostValueDelta

A

000010001050-50
A0101999899100
A10001010100010
A110180077030
B0000900925-25
B0101750800-50
B100080075050
B110157555025
        



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.

DeviceLevel1Level2Level3Level4PreValuePostValueDelta TypeDelta
A000010001050min-50
A0101999899max100
B0101750800min-50
B1000800750max50


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

DeviceDelta MinDelta Max
A-50100
B-5050


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
Icey
Community Support
Community Support

Hi @roncruiser ,

 

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

Icey_0-1656320165037.png

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.

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 

roncruiser
Post Patron
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.

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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

Top Kudoed Authors