From a0c331d2237a499dc9dc14ac49ac3f97242ddb42 Mon Sep 17 00:00:00 2001 From: Thomas Lento Date: Mon, 7 Aug 2023 14:38:58 -0700 Subject: [PATCH] Update ratio-metrics.md to reflect use of metrics as inputs Ratio metrics take metric inputs for the numerator and denominator, rather than measures. --- website/docs/docs/build/ratio-metrics.md | 30 +++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/website/docs/docs/build/ratio-metrics.md b/website/docs/docs/build/ratio-metrics.md index e206671d423..db108bd37fb 100644 --- a/website/docs/docs/build/ratio-metrics.md +++ b/website/docs/docs/build/ratio-metrics.md @@ -6,7 +6,7 @@ sidebar_label: Ratio tags: [Metrics, Semantic Layer] --- -Ratio allows you to create a ratio between two measures. You simply specify a numerator and a denominator measure. Additionally, you can apply a dimensional filter to both the numerator and denominator using a constraint string when computing the metric. +Ratio allows you to create a ratio between two metrics. You simply specify a numerator and a denominator metric. Additionally, you can apply a dimensional filter to both the numerator and denominator using a constraint string when computing the metric. The following displays the full spec for ratio metrics, along with an example: @@ -17,12 +17,14 @@ metrics: type: ratio # Required label: The value that will be displayed in downstream tools #Required type_params: # Required - numerator: the measure used for the numerator # Required - filter: filter for the numerator# Optional - alias: alias for the numerator # Optional - denominator: the measure used for the denominator # Required - filter: filter for the denominator # Optional - alias: alias for the denominator # Optional + numerator: the name of the metric used for the numerator, or a struct of properties as below # Required + name: name of metric used for the numerator # Required + filter: filter for the numerator# Optional + alias: alias for the numerator # Optional + denominator: the name of the metric used for the denominator, or a struct of properties as below # Required + name: name of metric used for the denominator # Required + filter: filter for the denominator # Optional + alias: alias for the denominator # Optional ``` ## Ratio metrics example @@ -30,13 +32,13 @@ metrics: ```yaml # Ratio Metric metrics: - - name: food_order_total_pct - description: "The food order total as the % of the total order" - label: Food Order Total % + - name: food_order_pct + description: "The food order count as a ratio of the total order count" + label: Food Order Ratio type: ratio type_params: - numerator: food_order_total - denominator: order_total + numerator: food_orders + denominator: orders ``` ## Ratio metrics using different semantic models @@ -90,7 +92,7 @@ on ## Add filter -Users can define constraints on input measures for a metric by applying a filter directly to the measure, like so: +Users can define constraints on input metrics for a ratio metric by applying a filter directly to the input metric, like so: ```yaml metrics: @@ -108,4 +110,4 @@ metrics: name: distinct_purchasers ``` -Note the `filter` and `alias` parameters for the measure referenced in the numerator. Use the `filter` parameter to apply a filter to the measure it's attached to. The `alias` parameter is used to avoid naming conflicts in the rendered SQL queries when the same measure is used with different filters. If there are no naming conflicts, the `alias` parameter can be left out. +Note the `filter` and `alias` parameters for the metric referenced in the numerator. Use the `filter` parameter to apply a filter to the metric it's attached to. The `alias` parameter is used to avoid naming conflicts in the rendered SQL queries when the same metric is used with different filters. If there are no naming conflicts, the `alias` parameter can be left out.