March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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 the 1st day, of month 12 (Dec.), last year.
Please help with the correct "if" query
Solved! Go to Solution.
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!
Hi @RafaelAri
You can try
Date.From(Date.StartOfMonth(Date.AddMonths([Date], -1)))
Hope this helps
Joe
Proud to be a Super User! | |
Date tables help! Learn more
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!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
85 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |