Forum Discussion
Conditional Column date and multiple criteria
- Anonymous2 years ago
Hi spandy34
I am confused that
1.the 4 weeks means due date>today and due date < future 4 weeks or due date>pre 4 weeks and due date < today?
2.Based on the first question, if the 4 weeks means ddue date>pre 4 weeks and due date < today, then should the firse condition be Due Date<pre 4 weeks instead of today?
Based on my understanding, i create the following conditions:
a. Due date<pre 4 weeks
b.due date>=pre 4 weeks and due date < today
c.dure date>=today
let _today=DateTime.Date(DateTime.LocalNow()), _4weeks=Date.AddWeeks(_today,-4), _condition= if [Due Date]<_4weeks and ([#"Milestone/Description"]="" or [#"Milestone/Description"]="Not Started") then "Red" else if [Due Date]<_today and [Due Date]>=_4weeks and ([#"Milestone/Description"]="" or [#"Milestone/Description"]="Not Started") then "Amber" else if [Due Date] >=_today and ([#"Milestone/Description"]="" or [#"Milestone/Description"]="Not Started" or [#"Milestone/Description"]="In Progress" or [#"Milestone/Description"]="Complete") then "Green" else null in _conditionOutput
And you can also refer to the attachment.
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi spandy34
I am confused that
1.the 4 weeks means due date>today and due date < future 4 weeks or due date>pre 4 weeks and due date < today?
2.Based on the first question, if the 4 weeks means ddue date>pre 4 weeks and due date < today, then should the firse condition be Due Date<pre 4 weeks instead of today?
Based on my understanding, i create the following conditions:
a. Due date<pre 4 weeks
b.due date>=pre 4 weeks and due date < today
c.dure date>=today
let
_today=DateTime.Date(DateTime.LocalNow()),
_4weeks=Date.AddWeeks(_today,-4),
_condition=
if [Due Date]<_4weeks and ([#"Milestone/Description"]="" or [#"Milestone/Description"]="Not Started") then "Red" else if [Due Date]<_today and [Due Date]>=_4weeks and ([#"Milestone/Description"]="" or [#"Milestone/Description"]="Not Started") then "Amber" else if [Due Date] >=_today and ([#"Milestone/Description"]="" or [#"Milestone/Description"]="Not Started" or [#"Milestone/Description"]="In Progress" or [#"Milestone/Description"]="Complete") then "Green" else null
in _condition
Output
And you can also refer to the attachment.
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi
Thank you - the principal worked and I have now got the column created with this solution Thank you for your help