Is it possible to add a measure in LookML explore?

Parita
New Member

I have two separate views and one explore joining both the views, I want to add a measure in LookML explore. Is it possible to do so and how? If not then how to create a measure from both views? Do I have to create another model?

0 1 1,059
1 REPLY 1

You do not. If you want to create a measure that will persist in your LookML then the only decision you need to ask yourself is whether it will live in the main view or the joining view.

Let’s take this example

Explore A = View A (base) + View B (join)

explore: view_a {
join: b {
relationship: one_to_many
type: left_outer
sql_on: ;;
}
}



view: view_a {
measure: count {
type: count
sql: ${your_id} ;;
}
}

view: view_b {
measure: revenue {
type: sum
sql: ${TABLE}.revenue ;;
}
}

Now, you want to create revenue per count (be it users, order, etc.). Two ways of doing it: 

view: view_a {
measure: revenue_per_count {
type: number
sql: ${view_b.revenue} / ${count} ;;
}
}

view: view_b {
measure: revenue_per_count {
type: number
sql: ${revenue} / ${view_a.count} ;;
}
}

What you need to consider is whether VIEW_A can exist somewhere without that join? If so I would put it in the view_b

Top Labels in this Space
Top Solution Authors