Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
NMOORE
Helper II
Helper II

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 earlisest (min) Analysis Date, and keep it's neighbouring FInalise Date.

 

NMOORE_0-1712265808262.png

 

Appreciate any help.

 

Thanks

3 ACCEPTED SOLUTIONS
sevenhills
Super User
Super User

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

sevenhills_0-1712267860942.png

 

OP:

sevenhills_1-1712267887508.png

 

 

View solution in original post

tamerj1
Super User
Super User

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
)
)
)

View solution in original post

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.

View solution in original post

7 REPLIES 7
lbendlin
Super User
Super User

No DAX needs to be harmed for this,  You can do this entirely in Power Query.  Sort by Analysis Date ascending and then deduplicate by Animals.

Yes, easy in Power Query, already accomplished. The question was for DAX

tamerj1
Super User
Super User

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
)
)
)

Hi, Thanks so much for your reply, I was trying to understand summarize and add columns better as I was half-way there but will look at understanding what you did here next week. Thanks again

sevenhills
Super User
Super User

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

sevenhills_0-1712267860942.png

 

OP:

sevenhills_1-1712267887508.png

 

 

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.

Please mark my reply as solution if you like it and also helps for the folks in future those who refer this thread.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.