Forum Discussion

stalerik's avatar
stalerik
Icon for Helper II rankHelper II
5 years ago
Solved

DAX help - create column with minimum value so far inside a group

Hello all,

 

I am looking for some help to create a calculated column which holds the minimum value recorded in a group. 

 

I have an Index, Group, and Value column.  The Lowest column should be the minimum value recorded in that group up to the index.

 

I thought this would be easy by filtering the Index to calculate the minumum value (MINX) between Index between Group and current Index but I just get zero.  I think it's finding the minumum value in the whole range insteas of evaluating row by row.

 

Here is some data to explain hwo the lowest should work:

 

IndexGroupValueLowest
232366
242333
252383
262393
272722
282742
292732
302700
312710
323266
333255
343233
353243
363273
373293
383211

 

Thanks for any ideas and help!

  • Hi, stalerik 

     

    Please try the below.

     

     

    Lowest CC =
    VAR currentgroup = 'Table'[Group]
    RETURN
    CALCULATE (
    MIN ( 'Table'[Value] ),
    FILTER (
    'Table',
    'Table'[Group] = currentgroup
    && 'Table'[Index] <= EARLIER ( 'Table'[Index] )
    )
    )

     

     

    Hi, My name is Jihwan Kim.

     

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

     

    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM

2 Replies

  • Hi, stalerik 

     

    Please try the below.

     

     

    Lowest CC =
    VAR currentgroup = 'Table'[Group]
    RETURN
    CALCULATE (
    MIN ( 'Table'[Value] ),
    FILTER (
    'Table',
    'Table'[Group] = currentgroup
    && 'Table'[Index] <= EARLIER ( 'Table'[Index] )
    )
    )

     

     

    Hi, My name is Jihwan Kim.

     

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

     

    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM

    • stalerik's avatar
      stalerik
      Icon for Helper II rankHelper II

      Thank you very much again Jihwan_Kim .  This is the second time you have helped me quickly with a problem.  Your solutions have been fantastic and understandable, and I appreciate the help!