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

[SL-1634] [Feature] Support Dimension-only queries for SCD dimensions #1019

Open
3 tasks done
Jstein77 opened this issue Jan 31, 2024 · 2 comments
Open
3 tasks done
Labels
enhancement New feature or request linear Low priority Created by Linear-GitHub Sync Metricflow Created by Linear-GitHub Sync

Comments

@Jstein77
Copy link
Contributor

Jstein77 commented Jan 31, 2024

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing metricflow functionality, rather than a Big Idea better suited to a discussion

Describe the feature

One use case for the semantic layer is generating unaggregated data sets for operational reporting. Think of questions like how many support tickets has this company created? The expected output is an unaggregated list of tickets that an operations team might use to evaluate customer health. Dimension-only queries are supported in the semantic layer today but don't work with SCD-type dimensions. For example, take the following schema:

Screenshot 2024-01-30 at 7 56 44 PM

The expected output is auction name, order_date and order_id where the order name is based on the validity window of the dim_auction semantic model.

We could create the following semantic models to model this relationship:

semantic_models:
  - name: dim_auctions
    model: ref('dim_auctions')
    description: "Table with one row per auction"
    primary_entity: auction
    entities:
      - name: auction
        type: natural
        expr: auction_code
    dimensions:
      - name: auction_name
        type: categorical
      - name: auction_date_start 
        type: time
        type_params:
          time_granularity: day 
          validity_params:
            is_start: True
      - name: auction_date_end 
        type: time
        type_params:
          time_granularity: day 
          validity_params:
            is_end: True
  - name: fct_orders
    defaults:
      agg_time_dimension: order_date
    model: ref('orders')  
    entities:
      - name: order
        type: primary
        expr: order_id
      - name: auction
        type: foreign
        expr: auction_code
    dimensions:
      - name: order_date
        type: time
        type_params:
          time_granularity: day
    measures:
      - name: orders
        agg: count_distinct
        create_metric: true

Then create a query that shows us the acution name, order date and order id mf query --group-by metric_time,order,auction__auction_name --explain

This query currently errors out, and we need to add a dummy metric in order for this to work for example adding a count of orders which will always return 1 since we're looking at the data set at the order_id level. mf query --metrics orders --group-by metric_time,order,auction__auction_name --explainDimension-only

Describe alternatives you've considered

You can work around this by adding a dummy metric and hiding it from the final view in the BI tool. This works, but we should support this natively.

Who will this benefit?

No response

Are you interested in contributing this feature?

No response

Anything else?

No response

From SyncLinear.com | SL-1634

@Jstein77 Jstein77 added enhancement New feature or request triage Tasks that need to be triaged labels Jan 31, 2024
@Jstein77 Jstein77 self-assigned this Jan 31, 2024
@Jstein77 Jstein77 changed the title [Feature] Support Dimension-only queries for SCD dimensions [SL-1634] [Feature] Support Dimension-only queries for SCD dimensions Jan 31, 2024
@Jstein77 Jstein77 added linear and removed triage Tasks that need to be triaged labels Jan 31, 2024
@courtneyholcomb
Copy link
Contributor

@jordan.stein thoughts on prio for this / where it should slot in?

@Jstein77 Jstein77 added Medium priority Created by Linear-GitHub Sync Metricflow Created by Linear-GitHub Sync labels Feb 5, 2024
@Jstein77 Jstein77 added Low priority Created by Linear-GitHub Sync and removed Medium priority Created by Linear-GitHub Sync labels Mar 5, 2024
@Jstein77
Copy link
Contributor Author

Jstein77 commented Mar 5, 2024

@courtneyholcomb I updated the status to low pri. This is a good one to keep in the backlog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request linear Low priority Created by Linear-GitHub Sync Metricflow Created by Linear-GitHub Sync
Projects
None yet
Development

No branches or pull requests

2 participants