Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

custum column if

Hello everyone,

 

How can i write an M code to get the must recent date between 2 columns(number 1 and number 2) and if de startdate is in 2018 and the enddate(number 3 ) is in 2019 the startdate must be 1-1-2019?

 

Thanks in advance.


5 Replies

  • Anonymous add custom column with following expression

     

    List.Max({[ColA],[ColB],[ColC]})
    • Anonymous's avatar
      Anonymous
      Not applicable
      I am not behind my pc right now but as i see the answer is 50% of the question. Makes me already happy.

      The second part is now we got highest number that the everything with a startdate in 2018 must be 1-1-2019 if the end date is in 2019.

      My goal:
      I am calculating cost of 1 Year per quarter. So Every startdate in 2018 with an enddate in 2019 i have go transform to 1-1-2019. The same for start date 2019 and end date in 2020. But my guess was that i could make up the code for 2019 start date and 2020 end date from the 2018 / 2019 question.
      • parry2k's avatar
        parry2k
        Icon for Super User rankSuper User

        Anonymous I'm not very clear about your 2nd question, if you give example wiht sample data it will help.