Forum Discussion

RanHo's avatar
RanHo
Icon for Helper V rankHelper V
2 years ago
Solved

How to get/display latest/recent comments per user

Good day!

I need help on this problem, I need to get or show the latest/most recent comments of user in table, here is my sample data/table:


as you can see I have employee and comments table and they are connected, and each user/employee has multiple comment with different date and others has same date but diff time.


Here the result I need :


any idea or help is appreciated!
Thanks in advance!

~Ran

  • RanHo 

    you can create columns

    comments date = maxx(RELATEDTABLE(comments),'comments'[COMMENTS DATE]
    comments = maxx(FILTER(RELATEDTABLE(comments),'comments'[COMMENTS DATE]='employee'[comments date]),comments[COMMENTS])
     
     
    or create measures
     
    commentdate = max('comments'[COMMENTS DATE])
    cid = maxx(FILTER(comments,comments[COMMENTS DATE]=comments[commentdate]),comments[COMMENTS])
     
     
     
    pls see the attachmetn below

     

     

8 Replies

  • RanHo 

    could you pls paste the table data here(not the screenshot)?

    for Dennis, why the output is not B1? that date is later than B

    • RanHo's avatar
      RanHo
      Icon for Helper V rankHelper V

      Oh my bad, i will edit just a typo. I'll try to paste it.

    • RanHo's avatar
      RanHo
      Icon for Helper V rankHelper V
      EMPLOYEE TABLE 
        
      EMPLOYEE IDEMPLOYEE NAME
      90001Paul
      90002Dennis
      90003Gregory
      90004Nathan
      90005Scott
      90006Julian
      90007Miles 
      90008Lara

       

      COMMENTS TABLE   
          
      COMMENT IDEMPLOYEE IDCOMMENTSCOMMENTS DATE
      100190001A8/1/24 12:31 PM
      100290002B8/1/24 12:00 AM
      100390004D7/6/24 12:00 AM
      100490002B18/24/24 12:00 AM
      100590003C8/7/24 12:00 AM
      100690004D17/16/24 12:00 AM
      100790007G9/1/24 9:37 AM
      100890001A18/13/24 2:23 PM
      100990005E9/2/24 9:33 AM
      101090005E19/3/24 11:12 AM
      101190006F8/30/24 2:42 PM
      101290003C18/24/24 6:37 AM
      101390003C28/28/24 3:41 PM
      101490007G19/1/24 11:00 AM
      101590008H8/28/24 7:22 AM
      101690001A28/29/24 8:16 AM
      101790001A38/29/24 4:00 PM
      101890008H19/1/24 10:19 AM
      101990006F18/31/24 3:25 PM
      102090004D28/17/24 7:25 AM
      • ryan_mayu's avatar
        ryan_mayu
        Icon for Super User rankSuper User

        RanHo 

        you can create columns

        comments date = maxx(RELATEDTABLE(comments),'comments'[COMMENTS DATE]
        comments = maxx(FILTER(RELATEDTABLE(comments),'comments'[COMMENTS DATE]='employee'[comments date]),comments[COMMENTS])
         
         
        or create measures
         
        commentdate = max('comments'[COMMENTS DATE])
        cid = maxx(FILTER(comments,comments[COMMENTS DATE]=comments[commentdate]),comments[COMMENTS])
         
         
         
        pls see the attachmetn below

         

         

  • Hi,

    I would solve this with Power Query.  Would you be OK with that?