Forum Discussion

matthewtjy's avatar
matthewtjy
Icon for Helper I rankHelper I
5 years ago
Solved

Getting MAX value IF 2 conditions are met

Hi, how do I go about to create a column "Max_Value_Of_Latest_Submit_Dt" where it would calculate the MAX Sales corresponding to the Latest_Submit_Dt for the particular Employee?

 

In excel I would use the formula {=MAX(IF(A2&D2=A:A&D:D,C:C))} to get the value in E2.

 

Thanks!

 

 ABCDE
1EmployeeSubmit_DtSalesLatest_Submit_DtMax_Sales_Of_Latest_Submit_Dt

2

A

1 Jan103 Jan4
3A3 Jan33 Jan4
4A3 Jan43 Jan4
5B2 Jan24 Jan5
6B3 Jan14 Jan5
7B4 Jan54 Jan5
8C5 Jan86 Jan4
9C5 Jan66 Jan4
10C6 Jan46 Jan4

 

  • Jihwan_Kim's avatar
    Jihwan_Kim
    5 years ago

    Sorry,

    the above was for the calculated measure.

    I posted one more reply that is for the calculated column.

     

     

     

5 Replies

  • Hi, matthewtjy 

    Pleaes try the below DAX measure.

     

    Max Sales of Last Submit Date =
    VAR lastsubmitdate =
    MAX ( 'Table'[Latest_Submit_Dt] )
    RETURN
    CALCULATE (
    MAX ( 'Table'[Sales] ),
    ALLEXCEPT ( 'Table', 'Table'[Employee] ),
    'Table'[Submit_Dt] = lastsubmitdate
    )

     

    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.

    • matthewtjy's avatar
      matthewtjy
      Icon for Helper I rankHelper I

      Hi i've tried to key in the DAX formula but no values appeared and there was no formula error also.

      Did I do something wrong?

      I used the formula
      Max Sales of Last Submit Date =
      VAR lastsubmitdate =
      MAX ( 'Table'[Latest_Submit_Dt] )
      RETURN
      CALCULATE (
      MAX ( 'Table'[Sales] ),
      ALLEXCEPT ( 'Table', 'Table'[Employee] ),
      'Table'[Submit_Dt] = lastsubmitdate
      )

      • Jihwan_Kim's avatar
        Jihwan_Kim
        Icon for Super User rankSuper User

        Sorry,

        the above was for the calculated measure.

        I posted one more reply that is for the calculated column.

         

         

         

  • Hi, matthewtjy 

    Sorry for the confuse.

    For creating column,

    please try below.

     

    Max Sales of Last Submit Date Column =
    VAR lastsubmitdate =
    CALCULATE( MAX ( 'Table'[Latest_Submit_Dt] ), ALLEXCEPT ( 'Table', 'Table'[Employee] ))
    RETURN
    CALCULATE (
    MAX ( 'Table'[Sales] ),
    ALLEXCEPT ( 'Table', 'Table'[Employee] ),
    'Table'[Submit_Dt] = lastsubmitdate
    )
     

    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.