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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
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 Date | Contract Status |
| 9/30/2022 | Inactive |
| 6/30/2023 | Active |
| 1/30/2023 | Pending |
Any help would be appreciated. Thanks!
Solved! Go to Solution.
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
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
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 16 | |
| 12 | |
| 9 | |
| 7 | |
| 6 |