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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Benedict21
Frequent Visitor

DAX next month

Hi, 

 

I am trying to create a column in my Date table that indicates the next month of the current date. My column reads:

 

IsNextMonth2 = 
Month(Dates[Date]) = MONTH(NOW() + 1)

 

It is reading True for December 2022 and False for all other months. But I want it to read True for January 2023 and False for all over months. Any suggestions? Thank you!

1 ACCEPTED SOLUTION

Hi @Benedict21 

Try the code:

Is Next_month = var to_date = EOMONTH(TODAY(),1)
return YEAR('Month'[Date])=YEAR(to_date)&&MONTH('Month'[Date])=MONTH(to_date)
vxinruzhumsft_0-1670315673480.png

 

Best Regards!

Yolo Zhu

View solution in original post

7 REPLIES 7
v-xinruzhu-msft
Community Support
Community Support

Hi @Benedict21 ,

 

You can try the following code I modified:

IsNextMonth2 =

Month(Dates[Date]) = MONTH(MONTH(NOW())+1)

vxinruzhumsft_0-1669961965880.png

 

 

 Best Regards,

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi!

 

Thank you but this is only capturing the next month value, not the month and year value.

Hi @Benedict21 

You can try the following code:

 

var to_date=EOMONTH(TODAY()),1)

return MONTH('Month'[Date])=MONTH(to_date)
 

Best Regards,

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi, 

Thank you so much for your response. Again, only showing next month; not month and year. Any suggestions?

 

Capture2.PNG

Hi @Benedict21 

Try the code:

Is Next_month = var to_date = EOMONTH(TODAY(),1)
return YEAR('Month'[Date])=YEAR(to_date)&&MONTH('Month'[Date])=MONTH(to_date)
vxinruzhumsft_0-1670315673480.png

 

Best Regards!

Yolo Zhu

amitchandak
Super User
Super User

@Benedict21 , Try like

 

eomonth(Date[Date],0) = eomonth(Today(),1)

 

 

Month Type = Switch( True(),
eomonth(Date[Date],0) = eomonth(Today(),0) ,"Current Month" , //This Month
eomonth(Date[Date],0) = eomonth(Today(),-1) && ,"Previous Month" , //last Month
eomonth(Date[Date],0) = eomonth(Today(),1) && ,"Next Month" , //last Month
[Month Year]
)

Hi! Thank you but I am getting a lot of incorrect syntax: Cannot find name 'Date'.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors