Forum Discussion

spandy34's avatar
spandy34
Icon for Responsive Resident rankResponsive Resident
2 years ago
Solved

Conditional column dates multiple criteria

Hi

 

I would like to create a Conditional Column called Status in Power Query and wondered if someone could help with the code for the following please as I am unsure of how to do it:

 

 

 

 

If the Due Date is less than Today and the [Milestone/Description] field is Blank or “Not Started” then input “Red”

Or

If the Due Date is within 4 weeks and the [Milestone/Description] field is Blank or “Not Started” then input “Amber”

Or

If the Due Date is greater than Today and the [Milestone/Description] field is Blank or “Not Started” or “In Progress” or “Complete” then input “Green”

danextian Greg_Deckler Anonymous Anonymous Anonymous 

 

  • Thats great and worked thank you for helping me.

2 Replies

  • = Table.AddColumn(#"Changed Type", "Custom", each if ([#"Milestone/Description"] = "Not Started" or [#"Milestone/Description"] = "") and Date.IsInPreviousNWeeks([Due Date], 4) then "Amber" else if [Due Date] > DateTime.Date(DateTime.LocalNow()) and ([#"Milestone/Description"] = "Not Started" or [#"Milestone/Description"] = "" or [#"Milestone/Description"] = "In Progress" or [#"Milestone/Description"] = "Complete") then "Green" else if ([#"Milestone/Description"] = "Not Started" or [#"Milestone/Description"] = "") and [Due Date] < DateTime.Date(DateTime.LocalNow()) then "Red" else "???")

    Try something like the above?

    • spandy34's avatar
      spandy34
      Icon for Responsive Resident rankResponsive Resident

      Thats great and worked thank you for helping me.