Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,15 @@ cubes:
views:
- name: total_revenue_per_customer
public: {{ COMPILE_CONTEXT['securityContext']['isFinance'] }}
includes:
- orders.total_revenue
- users.company

cubes:
- join_path: orders
includes:
- total_revenue

- join_path: orders.users
includes:
- company
```

```javascript
Expand All @@ -75,12 +81,25 @@ cube(`users`, {
});

// total_revenue_per_customer.js
view("total_revenue_per_customer", {
view(`total_revenue_per_customer`, {
description: `Total revenue per customer`,
public: COMPILE_CONTEXT.securityContext.isFinance,

includes: [orders.total_revenue, users.company],
});
cubes: [
{
join_path: orders,
includes: [
`total_revenue`
]
},
{
join_path: orders.users,
includes: [
`company`
]
}
]
})
```

</CodeTabs>
Expand Down
75 changes: 23 additions & 52 deletions docs/pages/reference/data-model/view.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,20 @@ view(`arr`, {
description: `Annual Recurring Revenue`,
public: COMPILE_CONTEXT.security_context.is_finance,

includes: [revenue.arr, revenue.date, customers.plan],
});
cubes: [
{
join_path: revenue,
includes: [
`arr`,
`date`
]
},
{
join_path: revenue.customers,
includes: `plan`
}
]
})
```

```yaml
Expand All @@ -302,12 +314,15 @@ views:
description: Annual Recurring Revenue
public: COMPILE_CONTEXT.security_context.is_finance

includes:
# Measures
- revenue.arr
# Dimensions
- revenue.date
- customers.plan
cubes:
- join_path: revenue
includes:
- arr
- date

- join_path: revenue.customers
includes:
- plan
```

</CodeTabs>
Expand Down Expand Up @@ -344,50 +359,6 @@ views:

The `access_policy` parameter is used to configure [data access policies][ref-ref-dap].

### `includes` (deprecated)

<WarningBox>

The top-level `includes` parameter is deprecated and might be removed in
the future. Please always use the `includes` parameter with `cubes` and
`join_path` parameters so you can explicitly control the join path.

</WarningBox>

The top-level `includes` parameter is used to bulk add measures or dimensions
to a view.

<CodeTabs>

```javascript
view(`active_users`, {
includes: [
// Measures
users.rolling_count,

// Dimensions
users.city,
users.created_at,
],
});
```

```yaml
views:
- name: active_users

includes:
# Measures
- users.rolling_count

# Dimensions
- users.city
- users.created_at
```

</CodeTabs>


[ref-recipe-control-access-cubes-views]:
/guides/recipes/access-control/controlling-access-to-cubes-and-views
[ref-schema-joins-direction]:
Expand Down