Union results of two looks into one dataset?

I have two separate looks, and I have a request to sum to total of each look into a single look.

The first look has criteria to pull sales volume($) for a few clients from Q1 to date,
While the other look is to pull sales volume for a separate list of clients from Q2 to date.

My ideal situation would be to union the results of each look and call it a day. Is that possible?

Thank you

0 1 2,746
1 REPLY 1

Your ideal situation is totally possible, if you get your hands a little bit dirty with SQL Runner or a derived table (If you don’t have access, reach out to your LookML developer or Looker Admin).

Basically, you’ll be able to grab the SQL executed by Look #1 and the SQL executed by Look #2 (so you still won’t have to build most of the SQL query manually), then craft either a derived table (if you need the result to be explorable) or a SQL runner query (If you just want to grab the unioned results and be done with it) that looks kinda like this, replacing with your two queries. If you’re using SQL runner, you’d only use the SQL part of the text below.

view: union_example {
  derived_table: {
    sql:
      SELECT 1 AS my_int
        FROM union_example1
      UNION
      SELECT 2 AS my_int
        FROM union_example2 ;;
  }
}

If you do the derived table approach but haven’t used DT’s before, I’d recommend you read this:

Using Derived Tables

Define, add persistence, reference, and troubleshoot derived tables.

Top Labels in this Space
Top Solution Authors