Entering Formula for Months

uk747

Well-known Member
Joined
Jul 20, 2011
Messages
843
Office Version
  1. 365
Platform
  1. Windows
I want to Extract a Month from a Date e.g. 20/01/2024 the column is called myDate

When I Click on Manage it opens Power Pivot so I entered a formula in a New Column =MONTH(qry1[myDate]) and it works fine it enters 1s for Jan 2 for Feb etc

However I wanted to format as January, February etc so I edited the formula to =FORMAT(MONTH(qry1[myDate]), "MMMM")
But instead of January for all Januarys Dates it Enters December and Februarys Dates it Enters January

PS would this have been better to do in the actual Power Query or in DAX
And if i wanted to use a Pivot Table, just drag the myDate Column 3 times and formatted in there
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Untested.
Excel Formula:
=FORMAT(qry1[myDate], "MMMM")

And if i wanted to use a Pivot Table, just drag the myDate Column 3 times and formatted in there
And if you wanted to use a pivot table just drag the myDate column ONCE and group by year, quarter, month.
 
Upvote 0
Thanks

Do you what the formulas are if entered in DAX
I entered =MONTH(qry1[myDate]) single value for column myDate in table 'qry1' cannot be determined
or =FORMAT(qry1[myDate], "MMMM") and neither worked

Even for YEAR I entered
=YEAR(qry1[myDate]) and got a single value for column myDate in table 'qry1' cannot be determined
Although it did work with =YEAR(MAX(qry1[myDate])) although I only have 2024 dates
 
Upvote 0
And if you wanted to use a pivot table just drag the myDate column ONCE and group by year, quarter, month.

I tried that but sometimes the extra grouped columns disappeared when refreshed

Also DO you know if any downside if I did it in Power Query as easier to do or better in DAX or in Power Pivot
 
Upvote 0
Do you what the formulas are if entered in DAX
I entered =MONTH(qry1[myDate]) single value for column myDate in table 'qry1' cannot be determined
or =FORMAT(qry1[myDate], "MMMM") and neither worked
I'm sorry. You have to wait for an DAXpert.

I tried that but sometimes the extra grouped columns disappeared when refreshed
That could happen if the date field can't be gouped anymore (like when the field contains text).

Also DO you know if any downside if I did it in Power Query as easier to do or better in DAX or in Power Pivot
I guess it doesn't matter. You could even go and insert a month field into the source data using a worksheet formula.
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top