Forum Discussion

Gregory-N's avatar
Gregory-N
Regular Visitor
4 years ago
Solved

DAX Max value if two columns content match

Hi, 

 

I need help to get the MAX from a column if two other columns data is a match.

 

See example and screenshots below;

 

If [ShipmentNo] in my Logistics table is = to [strCntDocID] in my ContainerDT table,  then I want to show the MAX number from the  [IntSeqNo] which is also in my ContainerDT table.

 

 

Hopefully someone can assist me.

 

Thanks,

 

Greg

  • Gregory-N 

    Add a Calculated Column in your Logistics table as follows:

    SeqNoMax =
    MAXX (
        FILTER ( ContainerDTtable, ContainerDTtable = LogisticTable[ShipmentNo] ),
        ContainerDTtable[IntSeqNo]
    )
    

4 Replies

  • Gregory-N 

    Add a Calculated Column in your Logistics table as follows:

    SeqNoMax =
    MAXX (
        FILTER ( ContainerDTtable, ContainerDTtable = LogisticTable[ShipmentNo] ),
        ContainerDTtable[IntSeqNo]
    )
    
  • Gregory-N's avatar
    Gregory-N
    Regular Visitor

    Good morning Fowmy 

     

    Thanks for the response.

     

    Unfortunately this doesn't work, it brings up an #ERROR.

     

    The error message is "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value"

     

    I added the column as per your above measure:

     

    SeqNoMax 

    = MAXX (
        FILTER ( tblContainersDT, tblContainersDT = 'PD&P Logistics'[ShipmentNo] ),
        tblContainersDT[IntSeqNo]
    )
     
    Please help with making this work.
     
    Regards;
    Greg
    • Fowmy's avatar
      Fowmy
      Icon for Super User rankSuper User

      Gregory-N 
      Hope you added this as a calculated column in your logistic table?
      Please share a screenshot of the error

      • Gregory-N's avatar
        Gregory-N
        Regular Visitor

        Hi Fowmy ,

         

        I did add it as a calculated column via fields, see below screenshot as requested.