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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Apple08
Helper IV
Helper IV

To retrieve the latest text by date and time

Hi All

 

I have two tables as shown below.  I would like to lookup the latest input from Table Two and add the latest input into Table One as shown below.  Please can anyone help to show me how to do it.  Any help is appreciated.  Many thanks.

 

Table One

NameLatest Input
Atesting 1
Btesting 5
Ctesting 9

 

Table Two

 

 

Name

InputDate and time
Atesting 112/09/2023 15:23
Atesting 223/08/2023 09:30
Atesting 321/07/2023 12:25
Btesting 412/08/2023 15:23
Btesting 512/08/2023 16:30
Btesting 611/08/2023 15:00
Ctesting 712/09/2023 09:00
Ctesting 823/08/2023 15:00
Ctesting 912/09/2023 16:00
Ctesting 1021/07/2023 12:00
1 ACCEPTED SOLUTION
nandukrishnavs
Super User
Super User

@Apple08  Create a calculated column and use the below DAX

Latest Input Value =
VAR _max_date_time =
    MAXX (
        FILTER (
            'Table 2',
            [Name] = EARLIER ( 'Table 1'[Name] )
        ),
        [Date and Time]
    )
VAR _latest_input =
    LOOKUPVALUE (
        'Table 2'[Input],
        'Table 2'[Name], [Name],
        'Table 2'[Date and Time], _max_date_time
    )
RETURN
    _latest_input

 

nandukrishnavs_0-1696510490857.png

 


Regards,
Nandu Krishna

View solution in original post

3 REPLIES 3
Apple08
Helper IV
Helper IV

Sorry, I forgot I also have a column 'Role' in table two and have to filter the role of user in table 2.  I have tried to update the code to add in the lookup of 'Assistant' and 'Admin' as below, however it doesn't work.  Please are you able to help.

 

 

Latest Input Value =
VAR _max_date_time =
    MAXX (
        FILTER (
            'Table 2',
            [Name] = EARLIER ( 'Table 1'[Name] )
        ),
        [Date and Time]
    )
VAR _latest_input =
    LOOKUPVALUE (
        'Table 2'[Input],
        'Table 2'[Name], [Name] &&
        'Table 2'[Role] in {"Assistant","Admin")
        'Table 2'[Date and Time], _max_date_time
    )
RETURN
    _latest_input

 

  

nandukrishnavs
Super User
Super User

@Apple08  Create a calculated column and use the below DAX

Latest Input Value =
VAR _max_date_time =
    MAXX (
        FILTER (
            'Table 2',
            [Name] = EARLIER ( 'Table 1'[Name] )
        ),
        [Date and Time]
    )
VAR _latest_input =
    LOOKUPVALUE (
        'Table 2'[Input],
        'Table 2'[Name], [Name],
        'Table 2'[Date and Time], _max_date_time
    )
RETURN
    _latest_input

 

nandukrishnavs_0-1696510490857.png

 


Regards,
Nandu Krishna

Thanks very much for your prompt response Nandu!  It works perfectly, I really appreciate your help! 🙂

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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