diff --git a/docs/docs/build/metrics-view/advanced-expressions/_category_.yml b/docs/docs/build/metrics-view/advanced-expressions/_category_.yml new file mode 100644 index 00000000000..2dfbd20f753 --- /dev/null +++ b/docs/docs/build/metrics-view/advanced-expressions/_category_.yml @@ -0,0 +1,4 @@ +position: 00 +label: Advanced Expressions +collapsible: true +collapsed: true \ No newline at end of file diff --git a/docs/docs/build/metrics-view/advanced-expressions/advanced-expressions.md b/docs/docs/build/metrics-view/advanced-expressions/advanced-expressions.md new file mode 100644 index 00000000000..8ccba62efc4 --- /dev/null +++ b/docs/docs/build/metrics-view/advanced-expressions/advanced-expressions.md @@ -0,0 +1,61 @@ +--- +title: "Advanced Expressions" +description: Tips & Tricks for Defining Metrics & Dimensions +sidebar_label: "Advanced Expressions" +sidebar_position: 00 +--- + +## Overview + +Within the metrcs view yaml, you can apply aggregate sql expressions to create derived metrics or non-aggregate expressions to adjust dimension settings. SQL expressions are specific to the underlying OLAP engine so keep that in mind when editing directly in the yaml. + +:::note Examples in Docs +For most of the examples here, DuckDB is being used. However most if not all the functionality is possible on different OLAP engines. You will need to refer to that specific OLAP's reference documentation. Don't hestitate to reach out to us if you have any questions! +::: + + +:::tip + +Rill's modeling layer provides open-ended SQL compatibility for complex SQL queries. More details can be found in our [modeling section](/build/models/models.md). + +::: + +## Measure Expressions + +Measure expressions can take any SQL numeric function, a set of aggregates and apply filters to create derived metrics. Reminder on basic expressions are available in the [create metrics view definition](../metrics-view.md#measures). + +See our dedicated examples and pages for the following advanced measures! +- **[Metric Formatting](./metric-formatting)** +- **[Case Statements and Filters](./case-statements)** +- **[Referencing Measures](./referencing)** +- **[Quantiles](./quantiles)** +- **[Fixed Metrics](./fixed-metrics)** +- **[Window Functions](./windows)** + + + + + +## Dimension Expressions + +To utilize an expression, replace the `column` property with `expression` and apply a non-aggregate sql expression. Common use cases would be editing fields such as `string_split(email, '@')[2]` to extract the domain from an email or combining values `concat(domain, child_url)` to get the full URL. + + ```yaml + - name: domain + display_name: Domain Name + expression: string_split(email, '@')[2] + description: "Extract the domain from an email" +``` +See our dedicated examples and pages for the following advanced dimensions! + +- **[Unnest Dimensions](./unnesting)** + +## Druid Lookups + +For those looking to add id to name mappings with Druid (as an OLAP engine), you can utilize expressions in your **Dimension** settings. Simply use the lookup function and provide the name of the lookup and id, i.e. `lookup(city_id, 'cities')`. Be sure to include the lookup table name in single quotes. + + ```yaml + - label: "Cities" + expression: lookup(city_id, 'cities') + description: "Cities" +``` \ No newline at end of file diff --git a/docs/docs/build/metrics-view/advanced-expressions/case-statements.md b/docs/docs/build/metrics-view/advanced-expressions/case-statements.md new file mode 100644 index 00000000000..80410a4c7a0 --- /dev/null +++ b/docs/docs/build/metrics-view/advanced-expressions/case-statements.md @@ -0,0 +1,80 @@ +--- +title: "Case Statements and Filters" +description: Tips & Tricks for Metric Formatting +sidebar_label: "Case Statements and Filters" +sidebar_position: 02 +--- + +One of the most common advanced measure expressions are [`case`](https://duckdb.org/docs/stable/sql/expressions/case.html) statements and [`filters`](https://duckdb.org/docs/stable/sql/query_syntax/filter.html) used to filter or apply logic to part of the result set. Use cases for case statements include filtered sums (e.g. only sum if a flag is true) and bucketing data (e.g. if between threshold x and y the apply an aggregate). While similar, case statements give you a bit more flexibilty as it allows you to set a custom value depending on what the case is. See below for some examples! + + +
+ +Please review the reference documentation, [here.](/reference/project-files/metrics-view) + +## Examples + +### Case Statements +The following expression sums of the values of Global_active_power only when considered to be a lower value. + +```yaml + - name: total_low_active_power_measure + display_name: Total Low Global Active Power + description: Total sum of Global Active Power where considered Low + expression: SUM(CASE WHEN GAP_category = 'Low' THEN Global_active_power ELSE 0 END) + format_preset: humanize + valid_percent_of_total: true +``` + +The following expression only considers the total value of users who are identified. + +```yaml + - name: total_value_for_identified_users + display_name: Total Value for Identified Users + description: Total Sum of Value for Identifed Users + expression: SUM(CASE WHEN user_id != '' OR user_id IS NOT NULL THEN value ELSE 0 END) + format_preset: humanize + valid_percent_of_total: true +``` + +The following expression modifies the value of the column based on the value of column XX + +```yaml + - name: modify_value + display_name: Arithmetic on Value + description: Arithmetic on Value based on XX + expression: | + SUM( + CASE + WHEN XX = 'multiply_10' THEN Value * 10 + WHEN XX = 'multiply_2' THEN Value * 2 + WHEN XX = 'divide_5' THEN Value / 5 + END + ) + format_preset: humanize + valid_percent_of_total: true +``` + + +### Filters +Similar to the above case statements, you can use the filter expression to filter the data on a specific column's value. However, in the example where we are explicilty changing the value in the CASE statement, this is not possible using only a filter. + +```yaml + - name: total_low_active_power_measure + display_name: Total Low Global Active Power + description: Total sum of Global Active Power where considered Low + expression: sum(Global_active_power) FILTER (WHERE GAP_category = 'Low') + format_preset: humanize + valid_percent_of_total: true +``` + +```yaml + - name: total_value_for_identified_users + display_name: Total Value for Identified Users + description: Total Sum of Value for Identifed Users + expression: SUM(value) FILTER (WHERE user_id != '' OR used_id IS NOT NULL) + format_preset: humanize + valid_percent_of_total: true +``` + ## Demo +[See this project live in our demo!](https://ui.rilldata.com/demo/rill-kaggle-elec-consumption/explore/household_power_consumption_metrics_explore) \ No newline at end of file diff --git a/docs/docs/build/metrics-view/advanced-expressions/fixed-metrics.md b/docs/docs/build/metrics-view/advanced-expressions/fixed-metrics.md new file mode 100644 index 00000000000..74aa8bcc905 --- /dev/null +++ b/docs/docs/build/metrics-view/advanced-expressions/fixed-metrics.md @@ -0,0 +1,69 @@ +--- +title: "Fixed Metrics" +description: Tips & Tricks for Metric Formatting +sidebar_label: "Fixed Metrics" +sidebar_position: 04 +--- + +Some metrics may be at a different level of granularity where a sum across the metric is no longer accurate. As an example, perhaps you have have a campaign with a daily budget of $5000 across five line items. Summing `daily_budget` column would give an inaccurate total of $25,000 budget per day. For those familiar Tableau, this is referred to as a `FIXED metric`. + + +
+ +To create the correct value, you can utilize DuckDB's unnest functionality. In the example below, you would be pulling a single value of `daily_budget` based on `campaign_id` to get the sum of budget for the day by campaign ids. Note that you can use mutliple keys if your granularity is defined by mulitple dimensions. + +```yaml +expression: | + select + sum(a.val) as value + from + ( select unnest( + list(distinct { + key: campaign_id, + val: daily_budget + }) + ) a + ) + ``` + +:::note + +The syntax for fixed metrics is specific to DuckDB as an OLAP engine as it required DuckDB specific commands. However, you can create a similar SQL expression using a different OLAP engine, too! + +::: +Please review the reference documentation, [here.](/reference/project-files/metrics-view) + + +## Example + +In the following example, each publishing company has a monthly minimum guarantee. As you'll see in the measure, `incorrect_sum_of_guarantee`, you'll get an incorrect value as this will sum multiple values as there are multiple shows and days per publisher. Another workaround would be to use MIN, MAX or AVG but when selecting multiple publishers, the values will not be accurate. + + +
+ +```yaml + - name: incorrect_sum_of_guarantee + expression: sum(min_guarantee_usd) + format_preset: currency_usd + valid_percent_of_total: false + + - name: guarantee_usd_measure_monthly + display_name: Monthly Minimum Guarantee USD + description: Total minimum guarantee in USD recorded in the dataset. + expression: > + SELECT SUM(a.val) AS value + FROM ( + SELECT unnest( + list(distinct { + key: publisher_id, + month: date_trunc('month', date), + val: min_guarantee_usd + }) + ) a + ) + format_preset: currency_usd + valid_percent_of_total: false +``` + +## Demo +[See this project live in our demo!](https://ui.rilldata.com/demo/sample-podcast-project/explore/podcast_explore) \ No newline at end of file diff --git a/docs/docs/build/metrics-view/advanced-expressions/metric-formatting.md b/docs/docs/build/metrics-view/advanced-expressions/metric-formatting.md new file mode 100644 index 00000000000..267c6203b7b --- /dev/null +++ b/docs/docs/build/metrics-view/advanced-expressions/metric-formatting.md @@ -0,0 +1,81 @@ +--- +title: "Formatting your Measures!" +description: Tips & Tricks for Metric Formatting +sidebar_label: "Metric Formatting" +sidebar_position: 01 +--- + +When creating your measures in Rill, you have the option to pick from a preset of formats that we provide to you or use the [d3-format](https://d3js.org/d3-format) parameter to format your data in any way you like. While the big number in the explore dashboard won't apply all the decimals changes (it will add currency or percentage if that is the type), you will be able to see the changes in the dimension leaderboard and pivot tables. + + +
+ + + +Using `format_d3` to control the format of a measure in the metrics view allows for further customization. + +:::tip Invalid format Strings +If an invalid format string is supplied, measures will be formatted with `format_preset: humanize`. If neither `format_preset` nor `format_d3` is supplied, measures will be formatted with the `humanize` preset). + +::: + +:::warning Cannot have both + Measures cannot have both `format_preset` and `format_d3` entries. +::: +Please review the reference documentation, [here.](/reference/project-files/metrics-view) + +## Customization + +For further customization of your measures, you can swtich to the YAML view and with our [metrics view reference documentation](/reference/project-files/metrics-view) use the [format_d3_locale](https://d3js.org/d3-format#formatLocale) parameter to create specific formatting. + +```yaml + format_d3: + format_d3_locale: + grouping: + currency: +``` + + +## Examples + +As explained in the introduction, you'll notice that in each of the screenshot the Big Number doesn't always follow the exact formatting, but will change based on percentage / currency formatting. This is as designed as there is a fixed width that the number has to be displayed. Instead you'll see these values in the dimension leaderboard, TDD and pivot tables. + +If you have any quesitons, please review our [reference documentation.](/reference/project-files/metrics-view) + +### Format a measure to include specific amount of decimals + +
+ +In the case that you need to view more granular values of your data, you can set the decimal places to whatever value you need. In the above example, we are setting the average voltage measure to 4 decimals spots to get a more accurate representation for each dimension. + +```yaml +format_d3: ".4f" +``` + + +### Format currency with different ',' locations. IE: Indian Rupee + +
+ + +```yaml +format_d3: "$," +format_d3_locale: + grouping: [3, 2, 2] + currency: ["₹", ""] +``` +As Indian Rupees are formatted in a different way than USD and EUR, you'll need to use the `format_d3_locale` parameter to set the exact grouping and currency. Likewise if the currency symbol is written after the numeric value, you can set the currency to `["". "$"]`. + +### Percentages + +
+ +```yaml +format_d3: '.4%' +``` +While our `format_preset: percentage` will automatically apply `.2%`, you can manually set the value in format_d3 if you are looking for a more specific measure format. + + + +## Demo +[See this project live in our demo!](https://ui.rilldata.com/demo/rill-kaggle-elec-consumption/explore/household_power_consumption_metrics_explore) \ No newline at end of file diff --git a/docs/docs/build/metrics-view/advanced-expressions/quantiles.md b/docs/docs/build/metrics-view/advanced-expressions/quantiles.md new file mode 100644 index 00000000000..2fa45a7974f --- /dev/null +++ b/docs/docs/build/metrics-view/advanced-expressions/quantiles.md @@ -0,0 +1,44 @@ +--- +title: "Quantiles" +description: Tips & Tricks for Metric Formatting +sidebar_label: "Quantiles" +sidebar_position: 03 +--- + +### Quantiles + +In addition to common aggregates, you may wish to look at the value of a metric within a certain band or quantile. In the example below, we can measure the P95 of a given measure using `QUANTILE_CONT`. + + +
+ + +Using [DuckDB aggregate function](https://duckdb.org/docs/stable/sql/functions/aggregates.html#quantile_contx-pos), you can easily calculate various quantiles. + +:::tip Not on DuckDB? +If you are using a different OLAP engine to power your dashboard, simply use the correct function for quantile. + +IE: [Clickhouse quantile](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantile), [Pinot percentile](https://docs.pinot.apache.org/configuration-reference/functions/percentile) +::: +Please review the reference documentation, [here.](/reference/project-files/metrics-view) + +## Examples + + +
+ +In this example we see the values of P95 and P99 are calculated using the following expressions: + +```yaml + - name: p95_quantile_global_intensity + expression: QUANTILE_CONT(Global_intensity, 0.95) + format_d3: ".3f" + description: P95 of Global Intensity + - name: p99_quantile_global_intensity + expression: QUANTILE_CONT(Global_intensity, 0.99) + format_d3: ".4f" + description: P95 of Global Intensity +``` + +## Demo +[See this project live in our demo!](https://ui.rilldata.com/demo/rill-kaggle-elec-consumption/explore/household_power_consumption_metrics_explore) \ No newline at end of file diff --git a/docs/docs/build/metrics-view/advanced-expressions/referencing.md b/docs/docs/build/metrics-view/advanced-expressions/referencing.md new file mode 100644 index 00000000000..f73892f5f6d --- /dev/null +++ b/docs/docs/build/metrics-view/advanced-expressions/referencing.md @@ -0,0 +1,51 @@ +--- +title: "Referencing Measures" +description: Tips & Tricks for Metric Formatting +sidebar_label: "Referencing Measures" +sidebar_position: 02 +--- + +Within a metrics view, it is possible for a measure to reference another by using the `requires` array parameter. By doing this, you could easily aggregate the already existing measures to simplify the expressions. IE: get a percentage of two already summed values. + + + +
+ +Please review the reference documentation, [here.](/reference/project-files/metrics-view) + +## Examples + +### Simple Aggregation +In the following example, `percentage_reactive_to_active_measure` uses the already defined measures `total_global_active_power_measure` and `total_global_reactive_power_measure` to calculate the percentage without having to recalculate the sum of the respective columns. + +
+ +```yaml + - name: percentage_reactive_to_active_measure + display_name: Percent Reactive to Active Power + requires: [total_global_active_power_measure, total_global_reactive_power_measure] + expression: total_global_reactive_power_measure / total_global_active_power_measure + format_preset: percentage +``` + + +### Window Function +If using a [window function](./windows), you'll need to define the measure that you are building the window for. In this example, we are getting the rolling sum of average voltage measurements for all time, that's a lot of volts! You can modify the frame to include less rows based on the order column. + + +
+ +```yaml + - name: rolling_sum_avg_voltage_all_time + display_name: Rolling Sum Windowed Voltage Average + expression: SUM(average_voltage_measure) + requires: [average_voltage_measure] + window: + order: Date + frame: RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW + treat_nulls_as: -1 +``` + + +## Demo +[See this project live in our demo!](https://ui.rilldata.com/demo/rill-kaggle-elec-consumption/explore/household_power_consumption_metrics_explore) \ No newline at end of file diff --git a/docs/docs/build/metrics-view/advanced-expressions/unnesting.md b/docs/docs/build/metrics-view/advanced-expressions/unnesting.md new file mode 100644 index 00000000000..18b575d09b6 --- /dev/null +++ b/docs/docs/build/metrics-view/advanced-expressions/unnesting.md @@ -0,0 +1,37 @@ +--- +title: "Unnest Dimensions" +description: Tips & Tricks for Metric Formatting +sidebar_label: "Unnest Dimensions" +sidebar_position: 06 +--- + For multi-value fields, you can set the unnest property within a dimension. If true, this property allows multi-valued dimension to be unnested (such as lists) and filters will automatically switch to "contains" instead of exact match. + + + +## Example +In this example, the data contains an array column that has the value `['deal_one', 'deal_two', 'deal_three']`. Setting the unnest property enables the user to filter on each value in the array. Metrics split by unnested values are non-additive, so that in this example the Total Impressions metric is applied equally across each value. Totals in Pivot Tables and the Time Dimension Detail view are calculated correctly, avoiding issues with "double counted" values when splitting multi-value dimensions. + + +
+ + ```yaml + - label: "Deal Name" + column: deal_name + description: "Unnested Column" + unnest: true +``` + +In another example, we are provided with a directory_path column that gives us information on which path was editted. Using Duckdb `regexp_split_to_array` we have converted the string into an array. Using `unnest`, we can see which top directories are being updated more than others. + +
+ +```yaml + - expression: regexp_split_to_array(directory_path, '/') + display_name: "The directory unnested" + description: "The directory path" + name: directory_path_unnested + unnest: true +``` + +## Demo +[See this project live in our demo!](https://ui.rilldata.com/demo/my-rill-tutorial/explore/advanced_explore?f=directory_path_unnested+IN+%28%27docs%27%29) \ No newline at end of file diff --git a/docs/docs/build/metrics-view/advanced-expressions/windows.md b/docs/docs/build/metrics-view/advanced-expressions/windows.md new file mode 100644 index 00000000000..a079f2b67e0 --- /dev/null +++ b/docs/docs/build/metrics-view/advanced-expressions/windows.md @@ -0,0 +1,45 @@ +--- +title: "Window Functions" +description: Tips & Tricks for Metric Formatting +sidebar_label: "Window Functions" +sidebar_position: 05 +--- + +In addition to standard metrics, it is possible to define running window calculations of your data whether you are looking to monitor a cumulative trend, smooth out fluctuations, etc. You'll need to navigate to the Code view in order to create a windowed measure. + +Please review the reference documentation, [here.](/reference/project-files/metrics-view) + + +## Example +In the below example, bids is another measure defined in the metrics view, and we are getting the previous week and current date's values and averaging them. This allows us to remove any short term trends to detect real patterns. You'll need to add the [`requires`](./referencing) array parameter to use reference another measure. + + +
update this photo + +```yaml + - name: bids_7day_rolling_avg + display_name: 7 Day Bid rolling avg + expression: AVG(total_bids) + requires: [total_bids] + window: + order: "__time" + frame: RANGE BETWEEN INTERVAL 6 DAY PRECEDING AND CURRENT ROW +``` + + +Another example is using a rolling sum with no bounding preceding rows, aka your whole data. This will be a cumulative sum of all of your measure's data, in this case it is the average voltage measure. + + +
+ +```yaml + - name: rolling_sum_avg_voltage_all_time + display_name: Rolling Sum Windowed Voltage Average + expression: SUM(average_voltage_measure) + requires: [average_voltage_measure] + window: + order: Date + frame: RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW +``` +## Demo +[See this project live in our demo!](https://ui.rilldata.com/demo/rill-kaggle-elec-consumption/explore/household_power_consumption_metrics_explore) \ No newline at end of file diff --git a/docs/docs/build/metrics-view/expressions.md b/docs/docs/build/metrics-view/expressions.md deleted file mode 100644 index 066931569cd..00000000000 --- a/docs/docs/build/metrics-view/expressions.md +++ /dev/null @@ -1,120 +0,0 @@ ---- -title: "Advanced Expressions" -description: Tips & Tricks for Defining Metrics & Dimensions -sidebar_label: "Advanced Expressions" -sidebar_position: 20 ---- - -## Overview - -Within the metrcs view yaml, you can apply aggregate sql expressions to create derived metrics or non-aggregate expressions to adjust dimension settings. SQL expressions are specific to the underlying OLAP engine so keep that in mind when editing directly in the yaml. - -We continually get questions about common metric definitions and other tricks so will update this page frequently. [Please let us know](../../contact.md) if you have questions or are stuck on an expression so we can add more examples. - -:::tip - -Rill's modeling layer provides open-ended SQL compatibility for complex SQL queries. More details can be found in our [modeling section](../models/models.md). - -::: - -## Measure Expressions - -Measure expressions can take any SQL numeric function, a set of aggregates and apply filters to create derived metrics. Reminder on basic expressions are available in the [create metrics view definition](metrics-view.md#measures). - -### Metric Formatting - -In addition to standard presents, you can also use `format_d3` to control the formatting of a measure in the metrics view using a [d3-format string](https://d3js.org/d3-format). If an invalid format string is supplied, measures will be formatted with `format_preset: humanize`. Measures cannot have both `format_preset` and `format_d3` entries. _(optional; if neither `format_preset` nor `format_d3` is supplied, measures will be formatted with the `humanize` preset)_ - - - **Example**: to show a measure using fixed point formatting with 2 digits after the decimal point, your measure specification would include: `format_d3: ".2f"`. - - **Example**: to show a measure using grouped thousands with two significant digits, your measure specification would include: `format_d3: ",.2r"`. - - **Example**: to increase decimal places on a currency metric would include: `format_d3: "$.3f"`. - -### Case Statements - -One of the most common advanced measure expressions are `case` statements used to filter or apply logic to part of the result set. Use cases for case statements include filtered sums (e.g. only sum if a flag is true) and bucketing data (e.g. if between threshold x and y the apply an aggregate). - -An example case statement to only sum cost when a record has an impression would look like: -```yaml - - label: TOTAL COST - expression: SUM(CASE WHEN imp_cnt = 1 THEN cost ELSE 0 END) - name: total_cost - description: Total Cost - format_preset: currency_usd - valid_percent_of_total: true -``` - -### Quantiles - -In addition to common aggregates, you may wish to look at the value of a metric within a certain band or quantile. In the example below, we can measure the P95 query time as a benchmark. - -```yaml - - label: "P95 Query time" - expression: QUANTILE_CONT(query_time, 0.95) - format_preset: interval_ms - description: "P95 time (in sec) of query time" -``` - -### Fixed Metrics / "Sum of Max" - -Some metrics may be at a different level of granularity where a sum across the metric is no longer accurate. As an example, perhaps you have have a campaign with a daily budget of $5000 across five line items. Summing `daily_budget` column would give an inaccurate total of $25000 budget per day. For those familiar Tableau, this is referred to as a FIXED metric. - -To create the correct value, you can utilize DuckDB's unnest functionality. In the example below, you would be pulling a single value of `daily_budget` based on `campaign_id` to get the sum of budget for the day by campaign ids. - -``` -(select sum(a.val) as value from (select unnest(list(distinct {key: campaign_id, val: daily_budget })) a )) -``` - -:::note - -The syntax for fixed metrics is specific to DuckDB as an OLAP engine. - -::: - -### Window Functions - -In addition to standard metrics, it is possible to define running window calculations of your data whether you are looking to monitor a cumulative trend, smooth out fluctuations, etc. -In the below example, bids is another measure defined in the metrics view and we are getting the previous and current date's values and averaging them. -```yaml - - display_name: bids_1day_rolling_avg - expression: AVG(bids) - requires: [bids] - window: - order: timestamp - frame: RANGE BETWEEN INTERVAL 1 DAY PRECEDING AND CURRENT ROW -``` -## Dimension Expressions - -To utilize an expression, replace the `column` property with `expression` and apply a non-aggregate sql expression. Common use cases would be editing fields such as `string_split(domain, '.')` or combining values `concat(domain, child_url)`. - - ```yaml - - label: "Example Column" - expression: string_split(domain, '.') - description: "Edited Column" -``` - -### Unnest - - For multi-value fields, you can set the unnest property within a dimension. If true, this property allows multi-valued dimension to be unnested (such as lists) and filters will automatically switch to "contains" instead of exact match. - - -
- -In this example, the data contains an array column that has the value `['deal_one', 'deal_two', 'deal_three']`. Setting the unnest property enables the user to filter on each value in the array. Metrics split by unnested values are non-additive, so that in this example the Total Impressions metric is applied equally across each value. Totals in Pivot Tables and the Time Dimension Detail view are calculated correctly, avoiding issues with "double counted" values when splitting multi-value dimensions. - - ```yaml - - label: "Deal Name" - column: deal_name - description: "Unnested Column" - unnest: true -``` - - -### Druid Lookups - -For those looking to add id to name mappings with Druid (as an OLAP engine), you can utilize expressions in your **Dimension** settings. Simply use the lookup function and provide the name of the lookup and id, i.e. `lookup(city_id, 'cities')`. Be sure to include the lookup table name in single quotes. - - ```yaml - - label: "Cities" - expression: lookup(city_id, 'cities') - description: "Cities" -``` \ No newline at end of file diff --git a/docs/docs/build/models/models.md b/docs/docs/build/models/models.md index 98feb9e3bde..4fbc1668f69 100644 --- a/docs/docs/build/models/models.md +++ b/docs/docs/build/models/models.md @@ -17,7 +17,7 @@ By default, data transformations in Rill Developer are powered by DuckDB and the It is possible to change the default [OLAP engine](https://docs.rilldata.com/build/olap/) for [the entire project](https://docs.rilldata.com/reference/project-files/rill-yaml#configuring-the-default-olap-engine) or [a specific metrics view](https://docs.rilldata.com/reference/project-files/metrics-view). You will need to define the connector credentials within your Rill project, or via the environmental variables. -For additional tips on commonly used expressions (either in models or dashboard definitions) visit our [common expressions page](../metrics-view/expressions.md). +For additional tips on commonly used expressions (either in models or dashboard definitions) visit our [common expressions page](../metrics-view/advanced-expressions/advanced-expressions.md). ## Adding a data model diff --git a/docs/docs/explore/dashboard-101.md b/docs/docs/explore/dashboard-101.md index fc3f3c66e24..ade1f6e64d8 100644 --- a/docs/docs/explore/dashboard-101.md +++ b/docs/docs/explore/dashboard-101.md @@ -39,10 +39,15 @@ The main screen of any Rill dashboard is called the _Explore_ page. As seen abov - _**Alerts, Bookmarks and Sharing:**_ You can create an [alert](./alerts/alerts.md) by selecting the bell, customizing the default view of the dashboard (see `purple` box) to a predefined set of metrics, dimensions, and filters by selecting the [bookmark](bookmarks.md), or share the dashboard ([internally by clicking the `Share` button](/manage/user-management#admin-invites-user-from-rill-cloud) or [externally via Public URLs](./public-url.md)) . -### Metrics Panel +### Measures Panel - _**Measures:**_ All _**metrics**_ that are available in the underlying model \ are viewable on the left-hand side, broken out with summary numbers (e.g. eCPM) and timeseries visualizations (based on your configured `timeseries` column in your [dashboard YAML](/reference/project-files/explore-dashboards.md)). You can add or remove any metric from the page by simply selecting them from the dropdown above the charts (see `yellow` box). If you select any specific measure, you will be navigating to the [Time Dimension Detail](https://docs.rilldata.com/explore/filters/tdd). +:::note Big Number Formatting + +[Formatting of your measures](/build/metrics-view/advanced-expressions/metric-formatting) will not change the granularity of the Big Number, but you'll see the formatting being applied to the TDD, Dimension Leaderboard, and Pivot tables. +::: + ### Dimensions Leaderboard Panel - _**Dimensions:**_ All _**dimensions**_ available in the underlying model on the right-hand side via leaderboard / toplist charts. You can add or remove any dimension from the page by simply selecting them from the dropdown above the charts (see `green` boxes). You can also drill into leaderboards further (see `blue` box) to see all corresponding metrics for a specific dimension. Within that drilldown, you can also then sort by metric, search your dimensions, and/or [export data](exports.md). diff --git a/docs/docs/home/install.md b/docs/docs/home/install.md index 1b24c90a0ae..2c30beb6204 100644 --- a/docs/docs/home/install.md +++ b/docs/docs/home/install.md @@ -17,7 +17,7 @@ Verify that the installation succeeded: rill --help ``` -:::tip sharing dashboards in Rill cloud? clone your git repo first +:::tip sharing dashboards in Rill cloud? Clone your git repo first If you plan to share your dashboards, it is helpful to start by creating a repo in Git. Go to https://github.com/new to create a new repo. Then, run the [Rill install script](#install-rill) in your cloned location locally to make deployment easier. More details on deploying Rill via Git in our [Deploy section](../deploy/deploy-dashboard/). @@ -51,26 +51,26 @@ On both macOS and Linux, you can install the latest nightly build using the inst curl https://rill.sh | sh -s -- --nightly ``` -:::warning MacOS users +:::warning macOS users If you previously installed Rill using `brew`, *the brew-managed binary will take precedent*. You can remove it by running `brew uninstall rill`. ::: -### What is nightly release? +### What is nightly released The nightly release will give you the most up-to-date version of Rill without having to wait for the official release. As these releases are not fully ready for production, you may encounter some issues. ## Installing a specific version of Rill -Rather than installing the latest version of Rill automatically, you can also install a specific version through the installation script by using the following command (e.g. `v0.40.1`): +Rather than installing the latest version of Rill automatically, you can also install a specific version through the installation script by using the following command (e.g., `v0.40.1`): ```bash curl https://rill.sh | sh -s -- --version ``` :::info Checking the Rill version -To check the precise version of available releases, you can navigate to the [**Releases**](https://github.com/rilldata/rill/releases) page of our [Rill repo](https://github.com/rilldata/rill). Note that if an invalid or incorrect version is passed to the install script, you will get prompted with an error to specify a correct version. +To check the precise version of available releases, you can navigate to the [**Releases'**](https://github.com/rilldata/rill/releases) page of our [Rill repo](https://github.com/rilldata/rill). Note that if an invalid or incorrect version is passed to the installation script, you will get prompted with an error to specify a correct version. ::: @@ -88,6 +88,12 @@ Once you have installed WSL and logged in to your Linux instance, you just need sudo apt-get update sudo apt-get install unzip ``` +:::tip Where should Rill be running? +Please check that you are running the commands in your Linux instance not from your Windows Command Prompt. + +If you are seeing strange behavior in Rill Developer, run the following command from the CLI to see where your project files are being save `echo "$PWD"`. If they are mounted from your Windows drive, you'll need to bring them into the WSL environment. + +::: With `unzip` installed, you're ready to install Rill. Just run: ```bash @@ -96,7 +102,7 @@ curl https://rill.sh | sh ## Manual Install -You can download platform-specific binaries from our [releases page on Github](https://github.com/rilldata/rill/releases). A manual download will not make Rill Developer globally accessible, so you'll need to reference the full path of the binary when executing CLI commands. +You can download platform-specific binaries from our [releases page on GitHub](https://github.com/rilldata/rill/releases). A manual download will not make Rill Developer globally accessible, so you'll need to reference the full path of the binary when executing CLI commands. ## Brew Install diff --git a/docs/docs/manage/security.md b/docs/docs/manage/security.md index d59186b0441..e5f0354bd4b 100644 --- a/docs/docs/manage/security.md +++ b/docs/docs/manage/security.md @@ -44,7 +44,7 @@ When developing access policies, you can leverage a fixed set of user attributes Note: Rill requires users to confirm their email address before letting them interact with the platform so a user cannot fake an email address or email domain. -If you require additional user attributes to enforce access policies, see the [example for custom attributes below](#advanced-example-custom-attributes) for more details. +If you require additional user attributes to enforce access policies, see the [example for custom attributes below](/manage/security#advanced-example-custom-attributes-embed-dashboards) for more details. ## Templating and expression evaluation diff --git a/docs/docs/reference/project-files/metrics-view.md b/docs/docs/reference/project-files/metrics-view.md index 4498c63323d..138f2d78774 100644 --- a/docs/docs/reference/project-files/metrics-view.md +++ b/docs/docs/reference/project-files/metrics-view.md @@ -69,9 +69,8 @@ In your Rill project directory, create a metrics view, `.yaml`, fi - `currency_eur` — output rounded to 2 decimal points prepended with a euro symbol: `€` - `percentage` — output transformed from a rate to a percentage appended with a percentage sign - `interval_ms` — time intervals given in milliseconds are transformed into human readable time units like hours (h), days (d), years (y), etc. - - - **`treat_nulls_as`** — used to configure what value to fill in for missing time buckets. This also works generally as COALESCING over non empty time buckets. _(optional)_ - - **`window`** — can be used for [advanced window expressions](/build/metrics-view/expressions), cannot be used with simple measures _(optional)_ + - **`treat_nulls_as`** — used to configure what value to fill in for missing time buckets. This also works generally as COALESCING over non empty time buckets. _(optional)_ + - **`window`** — can be used for [advanced window expressions](/build/metrics-view/advanced-expressions), cannot be used with simple measures _(optional)_ - **`partition`** — boolean _(optional)_ - **`order`** — using a value available in your metrics view to order the window _(optional)_ - **`ordertime`** — boolean, sets the order only by the time dimensions _(optional)_ diff --git a/docs/src/css/custom.scss b/docs/src/css/custom.scss index e74cedf7230..09e640e9786 100644 --- a/docs/src/css/custom.scss +++ b/docs/src/css/custom.scss @@ -274,13 +274,21 @@ li.theme-doc-sidebar-item-category-level-2 .menu__list-item-collapsible { // CSS for GIFS, make it look better .rounded-gif { - border-radius:10px; + border-radius: 10px; /* Rounded corners */ display: block; margin-left: auto; margin-right: auto; width: 100%; + + /* Shadow effect */ + box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.2); + + /* Outline effect */ + outline: 2px solid rgba(0, 0, 0, 0.1); + outline-offset: 2px; /* Space between the outline and the gif */ } + .rounded-png { border-radius:14px; display: block; diff --git a/docs/static/img/build/metrics-view/examples/case-example.png b/docs/static/img/build/metrics-view/examples/case-example.png new file mode 100644 index 00000000000..944c26d1f1c Binary files /dev/null and b/docs/static/img/build/metrics-view/examples/case-example.png differ diff --git a/docs/static/img/build/metrics-view/examples/currency-example.png b/docs/static/img/build/metrics-view/examples/currency-example.png new file mode 100644 index 00000000000..5354a16fcf6 Binary files /dev/null and b/docs/static/img/build/metrics-view/examples/currency-example.png differ diff --git a/docs/static/img/build/metrics-view/examples/decimal-example.png b/docs/static/img/build/metrics-view/examples/decimal-example.png new file mode 100644 index 00000000000..4cdb51249f7 Binary files /dev/null and b/docs/static/img/build/metrics-view/examples/decimal-example.png differ diff --git a/docs/static/img/build/metrics-view/examples/explore-percent.png b/docs/static/img/build/metrics-view/examples/explore-percent.png new file mode 100644 index 00000000000..320594c75f1 Binary files /dev/null and b/docs/static/img/build/metrics-view/examples/explore-percent.png differ diff --git a/docs/static/img/build/metrics-view/examples/incorrect-sum.png b/docs/static/img/build/metrics-view/examples/incorrect-sum.png new file mode 100644 index 00000000000..503ef65d10d Binary files /dev/null and b/docs/static/img/build/metrics-view/examples/incorrect-sum.png differ diff --git a/docs/static/img/build/metrics-view/examples/percent-example.png b/docs/static/img/build/metrics-view/examples/percent-example.png new file mode 100644 index 00000000000..d1884202c2f Binary files /dev/null and b/docs/static/img/build/metrics-view/examples/percent-example.png differ diff --git a/docs/static/img/build/metrics-view/examples/percentile-example.png b/docs/static/img/build/metrics-view/examples/percentile-example.png new file mode 100644 index 00000000000..e52dc243e5a Binary files /dev/null and b/docs/static/img/build/metrics-view/examples/percentile-example.png differ diff --git a/docs/static/img/build/metrics-view/examples/percentile-visual.png b/docs/static/img/build/metrics-view/examples/percentile-visual.png new file mode 100644 index 00000000000..d05d9f23cb1 Binary files /dev/null and b/docs/static/img/build/metrics-view/examples/percentile-visual.png differ diff --git a/docs/static/img/build/metrics-view/examples/requires-example.png b/docs/static/img/build/metrics-view/examples/requires-example.png new file mode 100644 index 00000000000..e6363ca3641 Binary files /dev/null and b/docs/static/img/build/metrics-view/examples/requires-example.png differ diff --git a/docs/static/img/build/metrics-view/examples/selecting-publishers.png b/docs/static/img/build/metrics-view/examples/selecting-publishers.png new file mode 100644 index 00000000000..0fb231773ec Binary files /dev/null and b/docs/static/img/build/metrics-view/examples/selecting-publishers.png differ diff --git a/docs/static/img/build/metrics-view/examples/tutorial-unnest.png b/docs/static/img/build/metrics-view/examples/tutorial-unnest.png new file mode 100644 index 00000000000..95086c85968 Binary files /dev/null and b/docs/static/img/build/metrics-view/examples/tutorial-unnest.png differ diff --git a/docs/static/img/build/metrics-view/examples/unnested-dimension.png b/docs/static/img/build/metrics-view/examples/unnested-dimension.png new file mode 100644 index 00000000000..d69ea63e938 Binary files /dev/null and b/docs/static/img/build/metrics-view/examples/unnested-dimension.png differ diff --git a/docs/static/img/build/metrics-view/examples/window-example.png b/docs/static/img/build/metrics-view/examples/window-example.png new file mode 100644 index 00000000000..08236a82bb7 Binary files /dev/null and b/docs/static/img/build/metrics-view/examples/window-example.png differ diff --git a/docs/static/img/build/metrics-view/metrics-editor.png b/docs/static/img/build/metrics-view/metrics-editor.png new file mode 100644 index 00000000000..fe7e8de31b5 Binary files /dev/null and b/docs/static/img/build/metrics-view/metrics-editor.png differ