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
PBI_newuser
Post Prodigy
Post Prodigy

Month/Year of Today ()

Hi,

There is error for the below Column, please advise if MONTH (TODAY()) and YEAR (TODAY()) can't be used here.

 

Error message:

DAX comparison operations do not support comparing values of type Text with values of type Integer.

Consider using the VALUE or FORMAT function to convert one of the values.

 
Flag = IF(Table[Due_Date]=BLANK(),1,
IF(OR(AND(Table[Due_Date].[Month]=MONTH(TODAY()),Table[Due_Date].[Year]=YEAR(TODAY())),
TODAY()<Table[Due_Date]),
0,1))

 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@PBI_newuser , Try like

Flag = IF( isblank(Table[Due_Date]),1,
IF(OR(AND( month(Table[Due_Date])=MONTH(TODAY()),year(Table[Due_Date])=YEAR(TODAY())),
TODAY()<Table[Due_Date]),
0,1))

 

Hope due_date is identified as date

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

sktneer
Resolver I
Resolver I

Table[Due_Date].[Month] will return Month Name and MONTH(TODAY()) will return the Month Number and they cannot be compared.

Therefore do a comparison between MONTH(Table[Due_Date]) and MONTH(TODAY()) because they both would return Numbers.

View solution in original post

2 REPLIES 2
sktneer
Resolver I
Resolver I

Table[Due_Date].[Month] will return Month Name and MONTH(TODAY()) will return the Month Number and they cannot be compared.

Therefore do a comparison between MONTH(Table[Due_Date]) and MONTH(TODAY()) because they both would return Numbers.

amitchandak
Super User
Super User

@PBI_newuser , Try like

Flag = IF( isblank(Table[Due_Date]),1,
IF(OR(AND( month(Table[Due_Date])=MONTH(TODAY()),year(Table[Due_Date])=YEAR(TODAY())),
TODAY()<Table[Due_Date]),
0,1))

 

Hope due_date is identified as date

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.

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.