Primary key

Hi,

I am having trouble with joining a NDT back into the source view.

I created a primary key in a refined view using:

view: +view{
  sql_table_name: (select generate_uuid() as primary_key, *
  FROM `schema.table`)

I also create some measures as a sum from some dimensions

I select this primary key, and these measures, as columns in a derived table ( I create additional measures also) , and because I want to use bind_all_filters I join the derived table to the original view in the explore parameter, and join on the primary key using sql_on like so:

explore: view {
  join: ndt {
    relationship: one_to_many
    sql_on: ${view.primary_key} = ${ndt.primary_key} ;;
  }

However, when I go to the explore, my summed measures in the refined view and the corresponding dimensions in the NDT do not match up, making my measures in the derived table incorrect. The primary_key in the derived table shows as Φ

Is this because my NDT is an aggregated version of the refined view, meaning if I simply bring primary_key through to the NDT it is no longer a primary key in the NDT

Do I need to define new primary key in my NDT?

Am I joining correctly?

Thanks!

0 0 165
0 REPLIES 0
Top Labels in this Space
Top Solution Authors