Forum Discussion

NMOORE's avatar
NMOORE
Helper II
2 years ago
Solved

Dax Table Summarize using Lookup

Hi,   I want to summarize a table keeping the corresponding values/Dates from a neighbouring column after an expression.   As the example shows I'm hoping to summarize the animals, calculate the ...
  • sevenhills's avatar
    2 years ago
    IDEAL_Backtest_Details = 
    ADDCOLUMNS( 
        SUMMARIZE(Backtest_Details, 
                  Backtest_Details[Animals], 
                  "Analysis Date",  min(Backtest_Details[Analysis Date])
        )
    
        , "Final Date", 
                LOOKUPVALUE(Backtest_Details[Final Date], 
                      Backtest_Details[Animals], [Animals],
                      Backtest_Details[Analysis Date],  [Analysis Date])
     )

     

    something like this?

     

    IP: Backtest_Details

     

    OP:

     

     

  • tamerj1's avatar
    2 years ago

    Hi NMOORE 

    if you're looking for a calculated table solution, you may try

    NewTable =
    GENERATE (
    VALUES ( 'Table'[Animals] ),
    CALCULATETABLE (
    TOPN (
    1,
    SELECTCOLUMNS (
    'Table',
    "Analysis Date", 'Table'[Analysis Date],
    "Finalise Date", 'Table'[Finalise Date]
    ),
    'Table'[Analysis Date], ASC
    )
    )
    )

  • NMOORE's avatar
    NMOORE
    2 years ago

    Thanks alot for this, I was playing around with it for a while trying to do exactly this but just couldnt get there. Much appreciated.