Forum Discussion
Conditional Formula for Power Query
- 3 years ago
Ok. It's because your existing columns are in DateTime format, not date.
Try this instead:
let _todayDate = Date.From(DateTime.LocalNow()) in if [Finding Type] = "Minor" and [Containment] = null and Duration.TotalDays(_todayDate - Date.From([Created])) > 5 then "Overdue" else if [Finding Type] = "Major" and [Containment] = null and Duration.TotalDays(_todayDate - Date.From([Created])) > 1 then "Overdue" else nullPete
Good Morning,
I have inserted the updated calculation and now gettings errors, i have validated the errors and the condition is true on errors but not sure why its showing error instead of "Overdue". Where the condtion is not true its showing "null" as per condition. Thoughts as to why this can be?
Can you click in one of the error cells (not the word 'error' itself, just the space in the cell next to it) and let me know what the error message says please?
Pete
- Anonymous3 years agoNot applicable
Didn't know you could do that! Thanks that a top tip!
Please see error message:
Thanks for the quick response.
- BA_Pete3 years agoSuper User
Ok. It's because your existing columns are in DateTime format, not date.
Try this instead:
let _todayDate = Date.From(DateTime.LocalNow()) in if [Finding Type] = "Minor" and [Containment] = null and Duration.TotalDays(_todayDate - Date.From([Created])) > 5 then "Overdue" else if [Finding Type] = "Major" and [Containment] = null and Duration.TotalDays(_todayDate - Date.From([Created])) > 1 then "Overdue" else nullPete
- Anonymous3 years agoNot applicable
Hi Pete, Thank you so much for your help, that did the trick!
I have learned some new tricks now.
Thank you once again!