Count days between timestamps, EXCLUDING WEEKENDS

Hi!
I’m trying to count the number of days between 2 timestamps excluding weekends.
I’ve found something like this on internet:
DATEDIFF(t.create_time, NOW()) - ((FLOOR(DATEDIFF(t.create_time, NOW()) / 7) * 2) + CASE WHEN DATEPART(DAY, t.create_time) - DATEPART(DAY, NOW()) IN (1, 2, 3, 4, 5) AND DATEPART(DAY, NOW()) != 0 THEN 2 ELSE 0 END + CASE WHEN DATEPART(DAY, t.create_time) != 0 AND DATEPART(DAY, NOW()) = 0 THEN 1 ELSE 0 END + CASE WHEN DATEPART(DAY, t.create_time) = 0 AND DATEPART(DAY, NOW()) != 0 THEN 1 ELSE 0 END)

But DATEPART, DATEDIFF and FLOOR are colored in white in Grafana query (and all the functions are normally colored with blue), so I think they’re not recognized :frowning:

Do you have a workaround or another solution?
Please let me know :smiley: