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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Junkay
Regular Visitor

Time intelligence function returning wrong month

Hi All,

 

I'm tring to extract month from date column in the table shown below. But I'm getting wrong month. For the month of July, Jan is returned in the month column. Please what could be the issue? I have checked my formula over and over again, but don't see anything wrong.

Junkay_0-1695522580109.png

 

3 ACCEPTED SOLUTIONS
OwenAuger
Super User
Super User

Hi @Junkay 

Change line 3 of the code to

 

"Month", FORMAT ( [DATE], "mmm" ),

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

Hi again @Junkay 

The ENDOFMONTH function will produce the expected result as long as the column reference provided as an argument is for a column which contains complete calendar months. If any dates are missing, this function treats the last available date in a given calendar month as the last day of the month. The tutorial you were using may have already had a table containing complete months.

 

For this reason, I would generally not advise using ENDOFMONTH to return a scalar end-of-month value. EOMONTH is the best function for this.

 

ENDOFMONTH is typically used within CALCULATE to modify a date filter by shifting it to the last day of the last visible month. ENDOFMONTH returns a 1x1 table which retains lineage to the column reference passed as its argument.

 

On to your latest question, to return an end-of-quarter date, I would advise using EOMONTH again.

For standard calendar quarters (Jan-Mar, Apr-Jun etc), an expression like this should work:

 

EOMONTH ( [Date], MOD ( - MONTH ( [Date] ), 3 ) )

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

Hi Owen,

 

You are a genius. Thank you so much for the support.

 

I wish I could be this proficient.

 

Thanks a million times.

View solution in original post

6 REPLIES 6
Junkay
Regular Visitor

Thanks greatly Owen,

 

EOMONTH function worked. But I wonder why ENDOFMONTH get accurate result in the tutorial I was using, but not working for me. Also, I have same challenge with ENDOF QUARTER function. It’s not returning the last day of the quarter. I’m not sure there’s EOQUARTER function in Power BI.

 

Formula:

 

Junkay_0-1695535059593.png

 

 

Result:

 

Junkay_1-1695535059597.png

 

 

Thanks Owen.

Hi again @Junkay 

The ENDOFMONTH function will produce the expected result as long as the column reference provided as an argument is for a column which contains complete calendar months. If any dates are missing, this function treats the last available date in a given calendar month as the last day of the month. The tutorial you were using may have already had a table containing complete months.

 

For this reason, I would generally not advise using ENDOFMONTH to return a scalar end-of-month value. EOMONTH is the best function for this.

 

ENDOFMONTH is typically used within CALCULATE to modify a date filter by shifting it to the last day of the last visible month. ENDOFMONTH returns a 1x1 table which retains lineage to the column reference passed as its argument.

 

On to your latest question, to return an end-of-quarter date, I would advise using EOMONTH again.

For standard calendar quarters (Jan-Mar, Apr-Jun etc), an expression like this should work:

 

EOMONTH ( [Date], MOD ( - MONTH ( [Date] ), 3 ) )

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Hi Owen,

 

You are a genius. Thank you so much for the support.

 

I wish I could be this proficient.

 

Thanks a million times.

Junkay
Regular Visitor

Thank you so much, Owen. This resolved it.

 

But I have another challenge. My End of Month function is also returning wrong result:

 

Formular below:

 

Junkay_0-1695527020734.png

Result below:

Junkay_1-1695527098466.png

 

Thanks for your support.

 

@Junkay Glad to hear it 🙂

If you want to return the end-of-month date as a scalar value, you should use the EOMONTH function (which works the same as in Excel).

In your example:

 

 

EOMONTH ( Orders[Order Date], 0 )

 

 

 

ENDOFMONTH is a time intelligence function, normally used to modify date filters. It will return a single-column/single-row table containing the last date of a month from the set of dates that exist in the column referenced.

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn
OwenAuger
Super User
Super User

Hi @Junkay 

Change line 3 of the code to

 

"Month", FORMAT ( [DATE], "mmm" ),

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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