Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello everyone!
I think my inquiry should be an easy one.
I want to find a way to compute a date based on the output of another date.
Say I have the following date,
DATE(2021,01,16)
I want to simply adjust this date to the same day of the previous month such that it has the following output;
DATE(2020,12,16)
Apparently PREVIOUSMONTH(DATE(2021,01,16)) does not work.
Any ideas?
Hello @CliffordAP
You can use dateadd .
LastMonth = DATEADD('Table'[Date], -1, Month)
NVM!
I figured it out. There is a simple way to do this.
You can use the MONTH function to calculate the previous month of the output date, and subtract the number of months.
DATE(2021,MONTH(DATE(2021,01,16))-1,16)
output
DATE(2020,12,16). 🙂
No, this is a very bad way to handle time calculations. Please read this and do not make mistakes others so easily do: Time Intelligence in Power BI Desktop - SQLBI
Looks good but watch out for the 31st. How do you want to handle those?
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |