Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v50 Docs and Tutorials #5802

Merged
merged 26 commits into from
Oct 17, 2024
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
2 changes: 1 addition & 1 deletion docs/blog/0.38.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Read more about how to configure Themes by visiting our docs page [here](../../r
## Available Time Ranges

Rill has always treated time as an essential part of the product and with this release you will get even more capabilities around customizing selectable time periods and comparison periods.
The `dashboard.yaml` introduces a new property called [available_time_ranges](/reference/project-files/dashboards) that allows you define time ranges in [this format](../../reference/rill-iso-extensions).
The `dashboard.yaml` introduces a new property called [available_time_ranges](/reference/project-files/explore-dashboards) that allows you define time ranges in [this format](../../reference/rill-iso-extensions).
You can either define this on a dashboard level or roll it out to all our dashboards via project defaults.

## Bug Fixes and Misc
Expand Down
4 changes: 2 additions & 2 deletions docs/blog/0.41.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ We have added a new driver for Clickhouse that allows you to have a live connect
Refer docs [here](/reference/olap-engines/clickhouse) for more details.

## Default comparisons
Previously in Rill, time comparison were turned on by default. We have now switched to comparisons being off by default and also introduced new syntax to the [`dashboard.yaml`](/reference/project-files/dashboards) that allows you to specify either your own time or dimensional comparison modes.
Previously in Rill, time comparison were turned on by default. We have now switched to comparisons being off by default and also introduced new syntax to the [`dashboard.yaml`](/reference/project-files/explore-dashboards) that allows you to specify either your own time or dimensional comparison modes.

## Dimension expressions
In addition to being able to define a specific column in your dataset as a dimension you can now supply an expression instead. That allows you to either visually transform the data without touching the underlying data model or for example to un-nest a nested column directly from your dimensions.
Expand All @@ -35,7 +35,7 @@ In addition to being able to define a specific column in your dataset as a dimen
If Pepperidge farm remembers so should Rill. We will now remember which dimensions and measures you were looking at and will automatically apply those for you when you come back to a dashboard.

## Default Dimensions and Measures
Dashboards can get crowded, the number of dimensions and measures grows over time. You can now specify which dimensions and measures that should be visible by default on the dashboard through new syntax in the [`dashboard.yaml`](/reference/project-files/dashboards). This allows you to control which measures and dimensions that should be visible for your users, making the initial cognitive load smaller while still allowing you to add more to the dashboard as you need them.
Dashboards can get crowded, the number of dimensions and measures grows over time. You can now specify which dimensions and measures that should be visible by default on the dashboard through new syntax in the [`dashboard.yaml`](/reference/project-files/explore-dashboards). This allows you to control which measures and dimensions that should be visible for your users, making the initial cognitive load smaller while still allowing you to add more to the dashboard as you need them.

## Support for environment-specific YAML configurations
We love our local developer tool but when working with very large datasets locally even the best of laptop can slow to a crawl.
Expand Down
107 changes: 67 additions & 40 deletions docs/docs/build/dashboards/customize.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,14 @@ You will find below some common customizations and dashboard configurations that

:::info Dashboard properties

For a full list of available dashboard properties and configurations, please see our [Dashboard YAML](/reference/project-files/dashboards.md) reference page.
For a full list of available dashboard properties and configurations, please see our [Dashboard YAML](/reference/project-files/explore-dashboards.md) reference page.

:::

### Changing Available Filters

**`default_time_range`**
**`time_ranges`**

Default time range controls the data analyzed on initial page load. Setting the default time range improves user experience by setting to most frequently used period - in particular, avoiding `all time` if you have a large datasource but only analyze more recent data.

The value must be either a valid [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations) (for example, `PT12H` for 12 hours, `P1M` for 1 month, or `P26W` for 26 weeks) or one of the [Rill ISO 8601 extensions](../../reference/rill-iso-extensions.md#extensions).

**`smallest_time_grain`**

Smallest time grain available for your users. Rill will try to infer the smallest time grain. One of the most common reasons to change this setting is your data has timestamps but is actually in hourly or daily increments. The valid values are: `millisecond`, `second`, `minute`, `hour`, `day`, `week`, `month`, `quarter`, `year`.

**`available_time_ranges`**

One of the more important configurations, available time ranges allow you to change the defaults in the time dropdown for periods to select. Updating this list allows users to quickly change between the most common analyses like day over day, recent weeks, or period to date. The range must be a valid [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations) or one of the [Rill ISO 8601 extensions](../../reference/rill-iso-extensions.md#extensions) - example below.
One of the more important configurations, available time ranges allow you to change the defaults in the time dropdown for periods to select. Updating this list allows users to quickly change between the most common analyses like day over day, recent weeks, or period to date. The range must be a valid [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations) or one of the [Rill ISO 8601 extensions](../../reference/rill-iso-extensions.md#extensions).

```yaml
available_time_ranges:
Expand All @@ -41,30 +30,66 @@ One of the more important configurations, available time ranges allow you to cha
- rill-WTD ## Week-To-date
```

**`available_time_zones`**
**`time_zones`**

Rill will automatically select several time zones that should be pinned to the top of the time zone selector. It should be a list of [IANA time zone identifiers](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). You can add or remove from this list for the relevant time zones for your team.

```yaml
- America/Los_Angeles
- America/Chicago
- America/New_York
- Europe/London
- Europe/Paris
- Asia/Jerusalem
- Europe/Moscow
- Asia/Kolkata
- Asia/Shanghai
- Asia/Tokyo
- Australia/Sydney
```

### Setting Default Views for Dashboards
:::tip
Starting from version 0.50, the default views have been consolidated into a single YAML struct, `defaults:`.
:::

**`default_dimensions`**
**`time_range`**

For dashboards with wide tables, setting default dimensions is a good way to make sure that users can focus on the primary analyses and ensure a positive first experience. Each dimension listed under the `default_dimensions` setting would appear on the screen, while the remainder of the dimensions would be hidden (and still available for selection under filters). Common use cases for setting default fields would be to simplify dashboards on initial load, to narrow the dashboard to the most used fields, and to avoid high cardinality fields (that may take longer to load, but are used less often so improve performance). An example addition to the `dashboard.yaml` file is below.
Default time range controls the data analyzed on initial page load. Setting the default time range improves user experience by setting to most frequently used period - in particular, avoiding `all time` if you have a large datasource but only analyze more recent data.

The value must be either a valid [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations) (for example, `PT12H` for 12 hours, `P1M` for 1 month, or `P26W` for 26 weeks) or one of the [Rill ISO 8601 extensions](../../reference/rill-iso-extensions.md#extensions).


**`dimensions`**

For dashboards with wide tables, setting default dimensions is a good way to make sure that users can focus on the primary analyses and ensure a positive first experience. Each dimension listed under the `dimensions` setting would appear on the screen, while the remainder of the dimensions would be hidden (and still available for selection under filters). Common use cases for setting default fields would be to simplify dashboards on initial load, to narrow the dashboard to the most used fields, and to avoid high cardinality fields (that may take longer to load, but are used less often so improve performance). An example addition to the `dashboard.yaml` file is below.

```yaml
default_dimensions:
- column1
- column2
defaults:
dimensions:
- column1
- column2
```

:::warning Column vs. Name Usage
The `column` property is used by default from the column name in your underlying source. If you decide to use the `name` property, you'd replace the column above with the field name.
:::

**`default_measures`**
**`measures`**

A list of measures that should be visible by default. Operates the same as the `default_dimensions` configuration. When selecting measures, by default, consider hiding more computationally intensive measures like `count distinct` or other complicated expressions to improve performance.

```yaml
defaults:
measures:
- measure_1
- measure_1
```

**`security`**

Defining security policies for your data is crucial for security. For more information on this, please refer to our [Dashboard Access Policies](/manage/security.md)

## Changing Themes & Colors

In your Rill project directory, create a `<theme_name>.yaml` file in any directory. Rill will automatically ingest the theme next time you run `rill start` or deploy to Rill Cloud and change the color scheme of your dashboard.
Expand All @@ -80,36 +105,38 @@ colors:

Once you have created that file, update the `dashboard.yaml` with the following configuration (we typically add this at the top along with time zones, time series and other configurations):

`default_theme: <name of theme yaml file>`
`theme: <name of theme yaml file>`

:::info Theme properties

For more details about configuring themes, you can refer to our [Theme YAML](/reference/project-files/themes.md) reference page.

:::

## Dashboard Measure Formatting
## Example

Formatting for individual measures on a dashboard can be controlled through the `format_preset` and `format_d3` properties.
```yaml
type: explore

### Euro currency
title: Title of your explore dashboard
description: a description
metrics_view: <your-metric-view-file-name>

Instead of displaying a numeric measure in USD currency, the euro currency can be used instead through `format_preset`. In the following example `dashboard.yaml`, the `Total Revenue` measure will be displayed using euros in the resulting dashboard.
dimensions: '*' #can use regex
measures: '*' #can use regex

```yaml
type: metrics_view
title: example_dashboard
model: example_model
measures:
- label: "Total Revenue"
expression: SUM(revenue)
name: total_revenue
description: "This measure calculates the total sum of revenue"
format_preset: currency_eur
```
theme: #your default theme

:::info Measure formatting options
time_ranges: #was available_time_ranges
time_zones: #was available_time_zones

For a full list of available dashboard measure formatting options, please see our [Dashboard YAML](/reference/project-files/dashboards.md) reference page.
defaults: #define all the defaults within here
dimensions:
measures:
time_range:
comparison_mode:
comparison_dimension:

:::
security:
access: #only access can be set on dashboard level, see metric view for detailed access policies
```
83 changes: 23 additions & 60 deletions docs/docs/build/dashboards/dashboards.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,78 +5,41 @@ sidebar_label: Create Dashboards
sidebar_position: 00
---

In Rill, your dashboards are defined by _metric definitions_. Metric definitions are composed of:
* _**A model**_ - A data model creating a One Big Table that will power the dashboard.
* _**A timeseries**_ - A column from your model that will underlie x-axis data in the line charts. Time will be truncated into different time periods.
* _**Measures**_ - Numerical aggregates of columns from your data model shown on the y-axis of the line charts and the "big number" summaries.
* _**Dimensions**_ - Categorical columns from your data model whose values are shown in _leaderboards_ and allows you to look at segments or attributes of your data (and filter / slice accordingly).
In Rill, dashboards are one of many components that access the metrics layer. Currently, it is possible to create an explore dashboard but more features are on the way!

:::note Dashboard Properties
For more details about available configurations and properties, check our [Dashboard YAML](/reference/project-files/dashboards) reference page.
:::

## Creating valid metrics

### Timeseries

Your timeseries must be a column from your data model of [type](https://duckdb.org/docs/sql/data_types/timestamp) `TIMESTAMP`, `TIME`, or `DATE`. If your source has a date in a different format, you can apply [time functions](https://duckdb.org/docs/sql/functions/timestamp) to transform these fields into valid timeseries types.

### Measures

Measures are numeric aggregates of columns from your data model. A measure must be defined with [DuckDB SQL](https://duckdb.org/docs/sql/introduction.html) aggregation functions and expressions on columns from your data model. The following operators and functions are allowed in measure expressions:

* Any DuckDB SQL [numeric](https://duckdb.org/docs/sql/functions/numeric) operators and functions
* This set of DuckDB SQL [aggregates](https://duckdb.org/docs/sql/aggregates): `AVG`, `COUNT`, `FAVG`,`FIRST`, `FSUM`, `LAST`, `MAX`, `MIN`, `PRODUCT`, `SUM`, `APPROX_COUNT_DISTINCT`, `APPROX_QUANTILE`, `STDDEV_POP`, `STDDEV_SAMP`, `VAR_POP`, `VAR_SAMP`.
* [Filtered aggregates](https://duckdb.org/docs/sql/query_syntax/filter.html) can be used to filter set of rows fed to the aggregate functions

As an example, if you have a table of sales events with the sales price and customer id, you could calculate the following metrics with these aggregates and expressions:
* Number of sales: `COUNT(*)`
* Total revenue: `SUM(sales_price)`
* Revenue per customer: `CAST(SUM(sales_price) AS FLOAT)/CAST(COUNT(DISTINCT customer_id) AS FLOAT)`
* Number of orders with order value more than $100 : `count(*) FILTER (WHERE order_val > 100)`

You can also add labels, descriptions, and your choice of number formatting to customize how they are shown in the dashboard.
![img](/img/build/dashboard/explore-dashboard.png)

* _**metrics_view**_ - A metrics view that powers the dashboard
* _**measures**_ - `*` Which measures to include or exclude from the metrics view, using a wildcard will include all.
* _**dimensions**_ - `*` Which dimensions to include or exclude from the metrics view, using a wildcard will include all.

### Dimensions
When including dimensions and measures only the named resources will be included.
Rill also supports the ability to exclude a set of named dimensions and measures.

Dimensions are used for exploring segments and filtering the dashboard. Valid dimensions can be any type and are selected using the drop down menu. You can also add labels and descriptions to your dimensions to customize how they are shown in the dashboard.
```yaml
metrics_view: my_metrics_view

dimensions: [country, region, product_category] # Only these three dimensions will be included
measures:
exclude: [profit] # All measures except profit will be included
```

## Updating dashboards
:::tip
Starting in version 0.50, metrics view has been separated from dashboard. This allows for a cleaner, more accessible metrics layer and the ability to build various dashboards and components on top of a single metrics layer. For more information on why we decided to do this, please refer to the following: [Why separate the dashboard and metrics layer](/concepts/metrics-layer)

### Using the UI / code
When you add a metrics definition using the UI, a code definition will automatically be created as a YAML file in your Rill project within the dashboards directory by default. However, you can also create metrics definitions more directly by creating the artifact.
For migration steps, see [Migrations](/manage/migration#v049---v050).
:::

In your Rill project directory, after the `dashboard_name.yaml` file is created in the `dashboards` directory, its configuration or definition can be updated as needed by updating the YAML file directly, using the following template as an example:

```yaml
type: metrics_view
model: model_name
title: Dashboard name
default_time_range: ""
smallest_time_grain: ""
timeseries: timestamp_column_name

dimensions:
- column: model_column_1
label: Column label 1
description: ""
# Add more dimensions here
:::note Dashboard Properties
For more details about available configurations and properties, check our [Dashboard YAML](/reference/project-files/explore-dashboards) reference page.
:::

measures:
- label: "Count"
name: "count"
expression: count(*)
description: ""
format_preset: "humanize"
# Add more measures here
```
:::info Check our reference documentation
### Preview a Dashboard in Rill Developer
Once a dashboard is ready to preview, before [deploying to Rill Cloud](/deploy/deploy-dashboard/), you can preview the dashboard in Rill Developer. Especially if you are setting up [dashboard policies](/manage/security), it is recommended to preview and test the dashboard before deploying.

For more information about available dashboard properties, feel free to check our [reference YAML documentation](/reference/project-files/dashboards).
![preview](/img/build/dashboard/preview-dashboard.png)

:::

### Multi-editor and external IDE support

Expand Down
4 changes: 4 additions & 0 deletions docs/docs/build/metrics-view/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
position: 38
label: Create Metrics Views
collapsible: true
collapsed: true
Loading
Loading