is there a simple method to calculate the distance between two values e.g. 10 and 30 which will result to 20. Currently I do it as follows:
CASE
WHEN value_1 < value_2 THEN
value_2 - value_1
ELSE value_1 - value_2
END AS difference_predicted_days
CodePudding user response:
The Absolute value function does the trick.
ABS(value1 - value2)