The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Is there Dax formula that I could use to get the first and last date of the last calendar month?
for example
for Today, I would like to return 1 Sept 2020 and 30 Sept 2020
for 29 Feb 2020, I would like to return 1 Jan 2020 and 31 Jan 2020 etc
Hi @Anonymous
You can create this very easily in query editor as well. Just click on your date column and on the ribbon above go to add column, there on the right side select date --> month -->End of the month or start of the month and 2 new columns are added into your data set just with few clicks.
Thanks,
Ankit Kukreja
Hi @Anonymous
If you want to return these as scalar values, you can use EOMONTH:
First Date of Last Month =
EOMONTH ( TODAY(), -2 ) + 1
Last Date of Last Month =
EOMONTH ( TODAY(), -1 )
As a side note (possibly not relevant to your situation), if you have a Date table and want to return a range of dates spanning the previous month (relative to today), you can use the PREVIOUSMONTH function:
PREVIOUSMONTH ( TREATAS ( { TODAY () }, 'Date'[Date] ) )
Regards,
Owen
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
58 | |
33 | |
20 | |
19 | |
15 |
User | Count |
---|---|
44 | |
36 | |
32 | |
23 | |
23 |