Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

First day of previous month as type Date

HI all,

 

I need to get the 1st day of last month (based on the current calendar month) into a measure but I have hit some confusion.

 

I started with,

 FOM = DATE(YEAR(TODAY()), MONTH(TODAY()), 1)

and tried to wrap a DATEADD around it to decrement the month,

FOM = DATEADD((DATE(YEAR(TODAY()), MONTH(TODAY()), 1)), -1, MONTH)

the problem is that when I do that I get the error "The first argument do 'DATEADD' must specify a column but I have seen examples others have used when an expression or function has been passed in as the date. Can anyone see where I am going wrong or suggest another approach?

 

Thanks

 

2 ACCEPTED SOLUTIONS

Not really, I'm just considering the case that'll happen about 4 weeks from now where the measure that I've suggested will try to return a month of 0 and break. I've just plugged that suggestion into a measure and it's returning November 1st right now, so the whole thing should look something like:

 

PreviousMonthStart = if(month(today())=1,date(year(today())-1,12,1),date(year(today()),month(today())-1,1))

 

Might be missing a bracket somewhere

View solution in original post

fabianbram
Advocate I
Advocate I

Can you try this? It worked for me... From what I understand you wanted the first day of last month. You can use this metric to get that:

 

FIRSTDAYOFMONTH = EOMONTH(TODAY(),-2)+1

View solution in original post

7 REPLIES 7
fabianbram
Advocate I
Advocate I

Can you try this? It worked for me... From what I understand you wanted the first day of last month. You can use this metric to get that:

 

FIRSTDAYOFMONTH = EOMONTH(TODAY(),-2)+1

Anonymous
Not applicable

@fabianbram that is a much more elegant solution and it should handle the year chenage easily becasue they are all date based functions. Thank you very much 

Your welcome!

 

jthomson
Solution Sage
Solution Sage

Could you not try to just add a -1 after MONTH(TODAY()) into the first measure you listed, and then if that's working for anything that's not January, put in an if statement to handle that case and take one off the year instead while making the month December?

Anonymous
Not applicable

@jthomson Thanks very much for the reply.

 

 

I am still quite new to Power BI, DAX and M and I have had trouble writing the custom elements. Am I right in saying that for a measure I would need the IF which is used in DAX? 

 

Thanks

 

 

 

Not really, I'm just considering the case that'll happen about 4 weeks from now where the measure that I've suggested will try to return a month of 0 and break. I've just plugged that suggestion into a measure and it's returning November 1st right now, so the whole thing should look something like:

 

PreviousMonthStart = if(month(today())=1,date(year(today())-1,12,1),date(year(today()),month(today())-1,1))

 

Might be missing a bracket somewhere

Anonymous
Not applicable

I have just seen your reply. Thanks very much, I have written the below and I guess I'll know if it can handle a year change properly in a few weeks!

FOM = 
	IF(MONTH(TODAY()) <> 1,
	FORMAT(DATE(YEAR(TODAY()), MONTH(TODAY())-1, 1),"DD/MM/YYYY"),
	FORMAT(DATE(YEAR(TODAY())-1, 12, 1),"DD/MM/YYYY")
	)

 

Thanks very much 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.