The WEEKVALUE function references another line item and returns the weekly time summary value for each time period within that week. The function replaces the period's individual value with the corresponding weekly summary.
For example, you can use the WEEKVALUE function to identify daily sales that fell below average in a certain week.
Syntax
WEEKVALUE(Line item)
Arguments
| Argument | Data type | Description |
| Line item | Number, Boolean, date, time period, list, text | The line item to reference the weekly time summary value for. |
The WEEKVALUE function returns a result of the same data type as the line item you reference.
Calculation engine functionality differences
In Polaris, you can't use the WEEKVALUE function in a result line item with a time scale greater than the function.
The Classic Engine returns a value of 0 in this case.
Constraints
- The line item that contains the WEEKVALUE function must have the Time Scale set to Day or Week.
- You can only use the WEEKVALUE function in models where the Calendar Type is based on weeks.
Examples
Days with sales above the weekly average
In this example, a Product sales module has line items on rows and Time on columns:
- The Daily sales and the Weekly sales line items have Number data types
- The Day below average for week line item has a Boolean data type
In Blueprint view, in the Summary column for Daily sales, Time Summary is set to Average. The formula for the Weekly sales returns the weekly summary average for every day of the week. The formula for the Day below average for week returns a TRUE result for values that are below the average value for each day of the week.
| 4 Jan 21 | 5 Jan 21 | 6 Jan 21 | 7 Jan 21 | 8 Jan 21 | 9 Jan 21 | 10 Jan 21 | |
| Daily sales | 200 | 254 | 122 | 543 | 233 | 350 | 431 |
Weekly salesWEEKVALUE(Daily sales) | 304.71 | 304.71 | 304.71 | 304.71 | 304.71 | 304.71 | 304.71 |
Day below average for weekDaily sales < WEEKVALUE(Daily sales) |