<!-- https://learnsql.cpetoday.com/functions/dax/weeknum -->
# WEEKNUM

Language: DAX
Category: Date and time
Syntax: WEEKNUM(<date>, <return_type>). Return type 1 (the default) starts weeks on Sunday and makes the week that contains January 1 week 1. Return type 2 starts weeks on Monday.
Summary: Returns the week number of the year for a date.
Returns: A whole number, usually from 1 to 53.
Level: Intermediate
Related: WEEKDAY, YEAR, DATE, CALENDAR, DAY

## What it does
WEEKNUM returns the number of the week in the year. Finance teams use it for weekly cash reports, weekly sales flashes and any process that runs on a weekly cycle. The result depends on the return type, which sets the first day of the week and which week counts as week 1. Type 2, with weeks starting on Monday, is the usual choice for a weekly report that runs Monday to Sunday.

## Syntax and arguments
- date: any date or datetime value. Required.
- return_type: 1 (weeks start on Sunday, the default) or 2 (weeks start on Monday). Optional.

## Example
A weekly cash report groups receipts and payments by week. Each Calendar row gets a week label such as 2026-W44, which sorts in time order.

```dax
Week Label =
YEAR('Calendar'[Date]) & "-W" & FORMAT(WEEKNUM('Calendar'[Date], 2), "00")
```

A date of October 29, 2026 falls in the week that starts on Monday, October 26. The label reads 2026-W44 when the week number is 44. FORMAT pads the number to two digits so the labels sort correctly.

## Example: a second, different use
A weekly count of invoices, with the week number shown beside each row of a matrix, for a trend chart.

```dax
Invoices This Week =
CALCULATE(
    COUNTROWS('Invoices'),
    WEEKNUM('Calendar'[Date], 2) = WEEKNUM(MAX('Calendar'[Date]), 2)
)
```

## Things to watch
- A week that crosses New Year can carry a week number that does not match the calendar year on the same row. Label weeks with a week start date or with a week year column built in the Calendar table.
- Week 1 means different things under different return types. State the type in the model documentation.
- WEEKNUM does not match ISO week numbers in every case. If an outside system uses ISO weeks, build the week column to the outside rule and check a few dates against it.
- For a weekly total that must cover full weeks, filter on the week start and end dates, not on one week number alone.

## In business terms
WEEKNUM supports weekly cash forecasting, weekly collections reviews, weekly sales flashes and weekly payroll or time reports. Teams that run a weekly close need the week labels to match their own calendar, or totals will not agree with the source system.
