Giter VIP home page Giter VIP logo

Comments (2)

Jstein77 avatar Jstein77 commented on May 20, 2024 1

Hey @gowthamgutha, thanks for opening an Issue. I'm gonna change this to a feature request since we're aware of this limitation. We currently only allow 2 hops, mainly because adding a third hop greatly increases the complexity of the join resolutions paths, and opens up a lot of ambiguous join paths.

It's something we're aware of, and we've already started doing some work to better handle ambiguous join resolution. Take a look at this PR for an example: #914.

The recommended path right now is to do some denormalization in dbt if you need metricflow to be able to join across more than 2 hops.

from metricflow.

gowthamgutha avatar gowthamgutha commented on May 20, 2024

Thanks for the update @Jstein77 . I've used de-normalized views to solve my use-case.

m_address.sql

{{ config(schema='Person') }}
select sp.Country, Person.Address.* from Person.Address left outer join {{ref('m_stateprovince')}} as sp on Person.Address.StateProvinceID = sp.StateProvinceID

m_stateprovince.sql

{{ config(schema='Person') }}
select Person.CountryRegion.Name as Country, Person.StateProvince.* from Person.StateProvince left outer join Person.CountryRegion on Person.StateProvince.COUNTRYREGIONCODE = Person.CountryRegion.COUNTRYREGIONCODE

The above two models have been changed to facilitate the use-case sumlinetotal by billing country.

The actual linkable dimension path ought to be sales_order_id__bill_to_address_id__state_province_id__country_region_id__country_name.

Now, with the below semantic model changes for billtoaddress, we can make sales_order_id__bill_to_address_id__country since we added the country in the m_address as shown above, so it can become a dimension in the billtoaddress semantic model.

  - name: billtoaddress
    defaults:
      agg_time_dimension: modified_date
    description: |
      sales order header
    model: ref('m_address')
    entities:
      - name: bill_to_address_id
        type: primary
        expr: AddressID
      - name: state_province_id
        type: foreign
        expr: StateProvinceID
    dimensions:
      - name: country
        expr: Country
        type: categorical
      - name: city
        expr: City
        type: categorical
      - name: modified_date
        expr: ModifiedDate
        type: time
        type_params:
          time_granularity: month

from metricflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.