Skip to content

Commit 528f058

Browse files
Add type property to custom granularities documentation
Generated-By: mintlify-agent
1 parent e84aed2 commit 528f058

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

references/lightdash-config-yml.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,15 @@ custom_granularities:
264264
fiscal_quarter:
265265
label: "Fiscal Quarter"
266266
sql: "DATE_TRUNC('quarter', ${COLUMN} + INTERVAL '1 month')"
267+
type: date
267268
week_monday:
268269
label: "Week (Mon-Sun)"
269270
sql: "DATE_TRUNC('week', ${COLUMN})"
271+
type: date
270272
fiscal_year:
271273
label: "Fiscal Year"
272274
sql: "EXTRACT(YEAR FROM ${COLUMN} + INTERVAL '1 month')"
275+
type: string
273276
```
274277

275278
Each custom granularity is defined as a key-value pair where the key is the granularity name (must be alphanumeric with underscores) and the value is an object with the following properties:
@@ -278,6 +281,7 @@ Each custom granularity is defined as a key-value pair where the key is the gran
278281
| :------- | :------- | :----- | :---------- |
279282
| `label` | Yes | string | A user-friendly label for the granularity as it will be displayed in the date zoom dropdown. |
280283
| `sql` | Yes | string | SQL expression that defines how to truncate/transform the date. Use `${COLUMN}` as a placeholder for the actual date column - it will be replaced with the column's SQL at runtime. |
284+
| `type` | No | `date`, `timestamp`, or `string` | The output type of the SQL expression. Use `date` for truncated dates, `timestamp` for truncated timestamps, or `string` for formatted text output (e.g., fiscal year labels). Defaults to `date` if not specified. |
281285

282286
### How custom granularities work
283287

@@ -291,6 +295,7 @@ custom_granularities:
291295
fiscal_quarter:
292296
label: "Fiscal Quarter"
293297
sql: "DATE_TRUNC('quarter', ${COLUMN} + INTERVAL '1 month')"
298+
type: date
294299
```
295300

296301
```yaml

0 commit comments

Comments
 (0)