We'll get to know the techniques:
1. Count working days with DAX function (EVALUATE, ROW, NETWORKDAYS):The DAX NETWORKDAYS
2. Using dates in literal format:
3. Join multiple rows in the same DAX (UNION) result:
4. Azure SQL
query to calculate working days (DATEDIFF, DATENAME):
- Example SQL query to calculate working days between two dates:
SELECT COUNT(*)
FROM Table
WHERE DATEDIFF(day, StartDate, EndDate) - (DATEDIFF(week, StartDate, EndDate) * 2) > 0
5. Create User-Defined Function (SCALAR-VALUED
FUNCTION):
6. Create User-Defined Table Type (USER-DEFINED
TABLE TYPE):
7. Convert comma-separated text
to lines (STRING_SPLIT):
- The STRING_SPLIT function is used to split a string into lines based on a delimiter. Example:
SELECT value FROM STRING_SPLIT('Text1,Text2,Text3', ',')
8. Declare variables in function (DECLARE, AS, BEGIN):In
9. Conditional for value validation (IF, BEGIN, END):Using
10. Insert
Values in Data Type Variable table:
11. Sum values with conditional between dates
(SUM, CASE, WHEN, BETWEEN, THEN):
12. Execute User-Defined Function (SELECT)
:
13. Table of constants and the use of the function (VALUES):