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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.