FIiter an explore before join

Arozin
New Member

Hello, so I have two problems.

PROBLEM1

So, I have this explore and join in a model. I want to join some values from table2, but I dont want to import all values. in table2 we have a column called A, and A can have 3 different values(say a,b and c).

from table2.A I inly want to join in the data from the row which have A=b as an example. 

explore: table1{
  from: source_table
  extends: [source_table]
  hidden: yes
  join: table2 {
    sql_on:  ${table1.user_id}=${table2.user_id};;
    relationship: one_to_one
    type: left_outer
  }

my first idea was to use the sql_where: function, but setting sql_where: A=b will filter out all data that doesn't have A=b in the whole explore im building. 

so the table1 explore im building will ONLY have users with A=b, and all other users will be hidden due to the filter. I still want to show the data from all the other users, just that they will have null as values of A.

anyone know how to do this?


PROBLEM2

my question here is how to set up filtered explores, and then joining them to other explores. 

as en example , I have this setup.

explore: table1{
  view_name: the_view_i_want
  sql_always_where: ${the_view_i_want.filter_column} = "first" ;;
}

explore: table_new{
  from: table2
  extends:

join: table1{

  relationship: one_to_one

  type: left_outer

  sql_on: ${table_new.id} = ${table1.id}

}

this one gives me errors on the join: saying that “join name must match a view, or the join must provide a from:”. and another error on the sql_on: saying “could not find a field named table1.id”

adding from: table1 in the join gives me the error “Could not find a view named "" to extend, possible missing include in view file”


I followed instructions in this post

https://community.looker.com/lookml-5/using-extensions-to-define-joins-3679

what am i doing wrong ?

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