Forum Discussion

RafaelAri's avatar
RafaelAri
Helper III
2 years ago
Solved

Custom date in power query

Hello, I need custome column in PQ, where I have already "Date" column. If month is 2 (Feb.) to 11 (Nov.), result is the 1st day of previous month, same year, . If monthe is 1 (Jan.), result is th...
  • manvishah17's avatar
    2 years ago

    Hi RafaelAri ,
    You can add a custom column and try this ,

     

    if Date.Month([Date]) = 1 then #date(Date.Year([Date])-1, 12, 1) else #date(Date.Year([Date]), Date.Month([Date])-1, 1))

     

    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!