Forum Discussion

carlosfaganello's avatar
carlosfaganello
Regular Visitor
5 years ago
Solved

Get the most recent between several dates for a record

I have two tables: Records and Comments.

Comments are related (*:1) to the Records.

Comments have a createdon date and Records have a modifiedon date.

 

I want to create a column in Records with the latest modification of the Record, for that I have to check the latest createdon Comment related to that Record and the modifiedon of the Record itself and decide which one is the most recent.

 

I'm new to PowerBI and this might be simple, but I have no idea how to do it.

  • Hi carlosfaganello 

    In a calc column, this should get you the latest relevant date from Comment

    Col =

    CALCULATE(MAX(Comments[CreatedOn])

     

    Then you can check with the modifiedOn from. I don't understand exactly what you need.

    In general, it very much helps if you show a sample of your tables and an example with the expected result based on that sample

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers 

     

     

     

3 Replies

  • AlB's avatar
    AlB
    Icon for Community Champion rankCommunity Champion

    Hi carlosfaganello 

    In a calc column, this should get you the latest relevant date from Comment

    Col =

    CALCULATE(MAX(Comments[CreatedOn])

     

    Then you can check with the modifiedOn from. I don't understand exactly what you need.

    In general, it very much helps if you show a sample of your tables and an example with the expected result based on that sample

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers 

     

     

     

    • carlosfaganello's avatar
      carlosfaganello
      Regular Visitor

      Hi AlB thanks for the response.

      I was actually missing the CALCULATE function.

  • AlB's avatar
    AlB
    Icon for Community Champion rankCommunity Champion

    carlosfaganello 

    You need it to trigger context transition and have the filter propagate down the relationship

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers