Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

3.9 KB
Raw Blame
name: Conditional Aggregations
entity_id: irROiaJoSsiXPKGxwWvWY
creator_id: [email protected]
display: table
collection_id: cOlQuErIeS0ExAmPlE2x1
parameters: []
parameter_mappings: []
dataset_query:
  database: Sample Database
  stages:
  - aggregation:
    - - count-where
      - {}
      - - '>'
        - {}
        - - field
          - {}
          - - Sample Database
            - PUBLIC
            - ORDERS
            - TOTAL
        - 100
    - - sum-where
      - {}
      - - field
        - base-type: type/Float
        - - Sample Database
          - PUBLIC
          - ORDERS
          - TOTAL
      - - '>'
        - {}
        - - field
          - {}
          - - Sample Database
            - PUBLIC
            - ORDERS
            - DISCOUNT
        - 0
    - - distinct-where
      - {}
      - - field
        - {}
        - - Sample Database
          - PUBLIC
          - ORDERS
          - USER_ID
      - - '>'
        - {}
        - - field
          - {}
          - - Sample Database
            - PUBLIC
            - ORDERS
            - TOTAL
        - 50
    - - share
      - {}
      - - not-null
        - {}
        - - field
          - {}
          - - Sample Database
            - PUBLIC
            - ORDERS
            - DISCOUNT
    breakout:
    - - field
      - temporal-unit: quarter
      - - Sample Database
        - PUBLIC
        - ORDERS
        - CREATED_AT
    source-table:
    - Sample Database
    - PUBLIC
    - ORDERS
    lib/type: mbql.stage/mbql
  lib/type: mbql/query
result_metadata:
- active: true
  base_type: type/DateTimeWithLocalTZ
  database_type: TIMESTAMP WITH TIME ZONE
  display_name: 'Created At: Quarter'
  effective_type: type/DateTimeWithLocalTZ
  field_ref:
  - field
  - - Sample Database
    - PUBLIC
    - ORDERS
    - CREATED_AT
  - temporal-unit: quarter
  id:
  - Sample Database
  - PUBLIC
  - ORDERS
  - CREATED_AT
  inherited_temporal_unit: quarter
  name: CREATED_AT
  position: 7
  semantic_type: type/CreationTimestamp
  source: breakout
  table_id:
  - Sample Database
  - PUBLIC
  - ORDERS
  unit: quarter
  visibility_type: normal
  lib/breakout?: true
  lib/deduplicated-name: CREATED_AT
  lib/desired-column-alias: CREATED_AT
  lib/original-display-name: Created At
  lib/original-name: CREATED_AT
  lib/source: source/table-defaults
  lib/source-column-alias: CREATED_AT
  lib/temporal-unit: quarter
- base_type: type/Integer
  display_name: Count of rows matching condition
  effective_type: type/Integer
  field_ref:
  - aggregation
  - 0
  name: count_where
  semantic_type: type/Quantity
  source: aggregation
  lib/deduplicated-name: count_where
  lib/desired-column-alias: count_where
  lib/original-name: count_where
  lib/source: source/aggregations
  lib/source-column-alias: count_where
- base_type: type/Float
  display_name: Sum of Total matching condition
  effective_type: type/Float
  field_ref:
  - aggregation
  - 1
  name: sum_where_TOTAL
  source: aggregation
  lib/deduplicated-name: sum_where_TOTAL
  lib/desired-column-alias: sum_where_TOTAL
  lib/original-name: sum_where_TOTAL
  lib/source: source/aggregations
  lib/source-column-alias: sum_where_TOTAL
- base_type: type/Integer
  display_name: distinct-where
  effective_type: type/Integer
  field_ref:
  - aggregation
  - 2
  name: distinct_where
  source: aggregation
  lib/deduplicated-name: distinct_where
  lib/desired-column-alias: distinct_where
  lib/original-name: distinct_where
  lib/source: source/aggregations
  lib/source-column-alias: distinct_where
- base_type: type/Float
  display_name: Share of rows matching condition
  effective_type: type/Float
  field_ref:
  - aggregation
  - 3
  name: share
  semantic_type: type/Percentage
  source: aggregation
  lib/deduplicated-name: share
  lib/desired-column-alias: share
  lib/original-name: share
  lib/source: source/aggregations
  lib/source-column-alias: share
visualization_settings: {}
card_schema: 24
serdes/meta:
- model: Card
metabase_version: v1.57.1-SNAPSHOT (14ff27d)
type: question