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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
ttocso
New Member

Compare year and date of 2 date only fields

Hi,

 

I have a calculated column where i am calculated the risk based on a number of variables. I would like to change this slightly so that in addition to the below, if the month and year of the 2 dates are equal, i would set the risk to medium. The 2 dates to compare are both date only formatted fields (Gantt_date and FISCAL_FIRST_OF_MONTH). 

 

If('Jira Status'= "Closed", "Available",
If('Jira Status'= "Resolved", "Available",
If(Not(IsBlank(HW_only)), "Available",
If(Not(IsBlank(Solution_available)), "Available",
If(Gantt_trend_date>FISCAL_FIRST_OF_MONTH,"High",
If(Gantt_trend_date<FISCAL_FIRST_OF_MONTH,"Low",
If(Gantt_trend_date=FISCAL_FIRST_OF_MONTH,"Medium",
If(IsBlank(Gantt_trend_date),"No Commit"
))))))))
1 ACCEPTED SOLUTION
v-venuppu
Community Support
Community Support

Hi @ttocso ,

Thank you for reaching out to Microsoft Fabric Community.

Thank you @wdx223_Daniel for the prompt response.

FORMAT() is not supported in calculated columns. Instead, compare year and month directly with YEAR() and MONTH():

IF (
YEAR ( 'Table'[Gantt_trend_date] ) = YEAR ( 'Table'[FISCAL_FIRST_OF_MONTH] )
&& MONTH ( 'Table'[Gantt_trend_date] ) = MONTH ( 'Table'[FISCAL_FIRST_OF_MONTH] ),
"Medium"
)

Embed this inside your existing risk logic. This way the column correctly sets risk to Medium when both dates fall in the same year and month.

View solution in original post

5 REPLIES 5
wdx223_Daniel
Super User
Super User

it is ok in my PBI App?

wdx223_Daniel_1-1758771797097.png

 

v-venuppu
Community Support
Community Support

Hi @ttocso ,

Thank you for reaching out to Microsoft Fabric Community.

Thank you @wdx223_Daniel for the prompt response.

FORMAT() is not supported in calculated columns. Instead, compare year and month directly with YEAR() and MONTH():

IF (
YEAR ( 'Table'[Gantt_trend_date] ) = YEAR ( 'Table'[FISCAL_FIRST_OF_MONTH] )
&& MONTH ( 'Table'[Gantt_trend_date] ) = MONTH ( 'Table'[FISCAL_FIRST_OF_MONTH] ),
"Medium"
)

Embed this inside your existing risk logic. This way the column correctly sets risk to Medium when both dates fall in the same year and month.

Many thanks app, appreciate the support. I can confirm this works as expected. 

ttocso
New Member

Thx for the reply. It says FORMAT is an unknown or unsupported function? 

wdx223_Daniel
Super User
Super User

If(FORMAT(Gantt_trend_date,"YYMM")=FORMAT(FISCAL_FIRST_OF_MONTH,"YYMM"),"Medium",

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors