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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
SJHALANI
Helper I
Helper I

Create new column based on date

Hello,

I have a column which has 'Contract End date' listed in it. I want to create a column 'Contract Status' next to it which does the following:

 

- if 'Contract End date' > current date, 'Contract Status' = Active

- if today - 60 days <'Contract End date' < today, 'Contract Status' = Pending

- if 'Contract End date' < today - 60 days, 'Contract Status' = Inactive

 

Contract End DateContract Status
9/30/2022Inactive
6/30/2023Active
1/30/2023Pending



Any help would be appreciated. Thanks!

 

1 ACCEPTED SOLUTION
Einomi
Helper V
Helper V

Hi,

You can try this

 

Table.AddColumn(PrevStep, "ContractStatus", each if [Contract End Date] > Date.From(DateTime.LocalNow()) then "Active"
else if [Contract End Date] > (Date.AddDays(Date.From(DateTime.LocalNow()),-60)) and [Contract End Date] < Date.From(DateTime.LocalNow()) then "Pending"

else if [Contract End Date] < (Date.AddDays(Date.From(DateTime.LocalNow()),-60))  then "Inactive"
else null)

 

I have tried on my data and it worked.

 

Hope it will be helpful

View solution in original post

2 REPLIES 2
SJHALANI
Helper I
Helper I

Thanks @Einomi This is working!

Einomi
Helper V
Helper V

Hi,

You can try this

 

Table.AddColumn(PrevStep, "ContractStatus", each if [Contract End Date] > Date.From(DateTime.LocalNow()) then "Active"
else if [Contract End Date] > (Date.AddDays(Date.From(DateTime.LocalNow()),-60)) and [Contract End Date] < Date.From(DateTime.LocalNow()) then "Pending"

else if [Contract End Date] < (Date.AddDays(Date.From(DateTime.LocalNow()),-60))  then "Inactive"
else null)

 

I have tried on my data and it worked.

 

Hope it will be helpful

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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