Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
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
User | Count |
---|---|
55 | |
46 | |
18 | |
16 | |
15 |
User | Count |
---|---|
115 | |
42 | |
41 | |
27 | |
22 |