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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
bhmiller89
Helper V
Helper V

EndOfMonth DAX Function Issues

I made a column: ThisDate= TODAY() 

 

I then attempted to make the column: EOM= ENDOFMONTH(Table[ThisDate])

 

The results return the same date as TODAY().  Why won't it return the date of the last day of the current month?

 

Any help is appreciated. 

5 REPLIES 5
v-caliao-msft
Employee
Employee

Hi Bhmiller89,

 

According to your description, you need to get the last day of current month by using a DAX expression, right?

 

If that is the case, you can use the DAX below
LastDay = EOMONTH(today(),0)
Capture.PNG

 

Regards,

Charlie Liao

Thank you so much! I've been struggling on how to get just the current date with the Now() function and this is basically the only way it works with the end of month DAX functions.

ISn't EndOfMonth() then essentially MAX() run on a dates column?



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Greg_Deckler
Super User
Super User

You want EOMONTH, not ENDOFMONTH. ENDOFMONTH returns the last day of the month in the current context of the date column specified, which in your case is always TODAY().

 

See EOMONTH here:

https://msdn.microsoft.com/en-us/library/ee634394.aspx#


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

I have a Calendar Table that ranges from 10/15/2018 to 03/28/2019. I wanted to add "Month" as a second column to use as a "Label" for aggregation. I used:

Month= ENDOFMONTH('Calendar'[Date])

 

3.png

When I pull this on to the visual, it misbehaves. I know this function has a scope of Current Context and that is fine with me in this case. What I don't understand is why Labels are "Offset" by a month?

1.png

I tried to change it from:

Month= ENDOFMONTH('Calendar'[Date]) to Month= STARTOFMONTH('Calendar'[Date])

This did fix my Latest month, but it also moved the first month.

2.png

Furthermore, changing TYPE of X-Axis does fix the issue by changing the Label Format; however that's not something I like to have.

4.png

Any expert opinion what's going on here? or is it a known issue or bug? 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.