Forum Discussion

satlasg's avatar
satlasg
Icon for Helper I rankHelper I
8 years ago

Get most recent values on new table column

Hello, 

I have two tables A & B with "many to one" relationship, as below:

Table A              Table B
I am looking for a formula to fill in 'Table B'[Value Latest] based on the Value from the more recent Date the ID has from Table A.
Any ideas please?

30 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Here is one way:

     

    Column = MAXX(RELATEDTABLE(IDValues),[Date]) 
    • satlasg's avatar
      satlasg
      Icon for Helper I rankHelper I

      It brings a result, but a date, not a Value that is needed, for the most recent date.

      • Zubair_Muhammad's avatar
        Zubair_Muhammad
        Icon for Community Champion rankCommunity Champion

        satlasg

         

        Try this column

         

        Value latest =
        VAR RecentDate =
            CALCULATE ( MAX ( TableA[Date] ) )
        RETURN
            CALCULATE (
                SUM ( TableA[Value] ),
                FILTER ( TableA, TableA[Date] = RecentDate )
            )