Forum Discussion

amart's avatar
amart
Frequent Visitor
2 years ago
Solved

DAX Measure for Max Column Value Based on Date

Hey everyone, 

 

I've been at this for a while, it feels like it shouldnt be this hard. Any help greatly appreciatied.

 

I have a table of data with Corporate Officers - I want to show the MAX DATE or MOST RECENT DATE for each Officer Position. In other words, if we appoint a new Secretary, President etc. in this expression I only want to show the MOST RECENTLY appointed officer. 

 

Below is a sample of the table - highlighted are the officers that have been superceeded by new appointees.

 

 

Thank again!

  • Do a grouping on the company id and  position and aggregate by max appointment_date, but add a "all rows" aggregate.

    Then expand the tables back out (without the company id and position fields) and then mark all rows where the appointment_date matches the max appointment date.

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi amart ,

     

    Your requirement is to keep the row with the largest appointment_date if company_id and position are same.

     

    Please follow my steps if I understand you correctly:

     

    My approach is somewhat similar to lbendlin is, with slight differences in the details, thank him very much.

     

    Go to Power Query and select company_id and position columns for group by.

     

    To this step has realized your needs.

     

    If you have other questions please feel free to contact me.

     

    The pbix file is attached.

     

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi amart ,

     

    Your requirement is to keep the row with the largest appointment_date if company_id and position are same.

     

    Please follow my steps if I understand you correctly:

     

    My approach is somewhat similar to lbendlin is, with slight differences in the details, thank him very much.

     

    Go to Power Query and select company_id and position columns for group by.

     

    To this step has realized your needs.

     

    If you have other questions please feel free to contact me.

     

    The pbix file is attached.

     

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

  • Do a grouping on the company id and  position and aggregate by max appointment_date, but add a "all rows" aggregate.

    Then expand the tables back out (without the company id and position fields) and then mark all rows where the appointment_date matches the max appointment date.