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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
naoyixue1
Post Patron
Post Patron

How to find Year and Month with date format

Hey there,

 

Is there any way to help to pinpoint Year & Month (format look like: January 2024) For example, I want to flag 'Y", as long as Year and Month = 'January 2024', but it also bring the data with 'Feburary 2024 there'. I know I can use say year & month with number (Year * 100 + Month). But just curious whether there are some ways for me to directly do condition for year and month with date format directly? Thanks!

 

naoyixue1_0-1715385290081.png

naoyixue1_1-1715385580114.png

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

maybe you can try 

if( [year and month]= "January 2024", "Y')

 

or 

 

if (format([date],"mmmm")&" "&year([date])="January 2024", "Y')





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
HotChilli
Super User
Super User

I'm only understanding half of this question.

If you want to test a date use the YEAR and MONTH DAX functions.

If you have a problem with the LOOKUPVALUE returning values in February when they should be in January, show us the rows that are returning February (wrongly) and show us the Time_lookup table.

ryan_mayu
Super User
Super User

maybe you can try 

if( [year and month]= "January 2024", "Y')

 

or 

 

if (format([date],"mmmm")&" "&year([date])="January 2024", "Y')





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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