Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register 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!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
78 | |
76 | |
59 | |
35 | |
33 |
User | Count |
---|---|
100 | |
62 | |
56 | |
47 | |
41 |