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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.