What’s the most efficient way to count weekdays between two given dates in Sigma?
One way to do this would be via the following formula:
DateDiff(“day”, [Start Date], [End Date]) - (DateDiff(“week”, [Start Date], [End Date]) * 2) + If(Weekday([Start Date]) = 7 and Weekday([End Date]) = 7, 0, Weekday([Start Date]) = 7, 1, Weekday([End Date]) = 7, -1, 0)
One thing I noticed is that when you copy this SQL from here into Sigma, the double-quotes in “day” and “week” get replaced with some weird double-quotes, that cause a Sigma error. If that happens, just go ino the formula and replace them with the standard double-quotes.
Wrong double-quotes when copy-pasting (diagonal, slanted to the right)
Standard double-quotes (fully vertical):