Forum Discussion
Adam01
4 years agoAdvocate I
Calculating Date Diff based on blank columns
Hello everyone, I have a bit of an odd one today I am trying to create a custom column that calculates that date diff between todays date and EITHER the "Ideal Due Date" Column OR the "Fixed Dead...
- Anonymous4 years ago
Hi,
Try the below solution
Days until Deadline = -- Returns true if both columns are blank var CheckBlanks = ISBLANK('Table'[Ideal Due Date]) && ISBLANK('Table'[Fixed Deadline]) -- Returns the difference prioritising Fixed Deadline column var DaysDiff = int(TODAY() - COALESCE('Table'[Fixed Deadline], 'Table'[Ideal Due Date])) return if(CheckBlanks, "No Deadlines set", CONVERT(DaysDiff, STRING))
PVO3
4 years agoImpactful Individual
And for the nice to have. I would put this in a SWITCH instead of IF because of readability.
Example:
SWITCH(TRUE(),
ISBLANK(Ideal due date) && ISBLANK(Fixed deadline), "No Deadlines set",
NOT ISBLANK(Ideal due date) && NOT ISBLANK(Fixed deadline), INT(TODAY() - Fixed deadline)
)
Adam01
4 years agoAdvocate I
Implementing this code gives me the following: