How to summarize daily sales data with quarterly sales targets?

I have daily sales data (from Salesforce, if that’s helpful) that I’d like to summarize on quarterly, regional dimensions. 

Consider the following sales table -- we’ll call this explore “Accounts and Opportunities”

20299f3e-f94f-48b0-bc96-07097fbe0dc5.png

I also have the following quarterly, regional sales targets table - we’ll call this explore “Sales Targets”

c4857732-c66a-423d-b01b-f10883bc0fb6.png

I’d like to join these data sets so that I can create the following tables as looks for my end users: 

7a2ead37-45a4-46c6-9ff5-44521773e214.png

When I join these two explores (on region & year-quarter), I get the following when I try to summarize: 

f7b1284b-09d0-479c-b80d-07b5b8d810a1.png

We can see the target amount is way off from above -- in fact it’s a multiple of the number of sales records we have because the join did the following: 

8d2bec97-f84f-40a5-8064-0856875b6654.png

I’m now incorrectly summing the quarterly target as if it’s a daily amount like the sales data. 

What’s the best way to combine these two data sets so that I can get to my ideal summary results as shown above?

Keep in mind that there are a number of other dimensions from the “Accounts and Opportunities” table that my users may want to filter on. There are also many more regions. I want to avoid doing this all through table calculations as it’s incredibly manual and inflexible. I want to be able to maintain my “Sales Targets” table outside of Looker. 

Thanks!

0 1 457
1 REPLY 1

The answer is changing the measure in my view: 

Previous:

  measure: target_amount {
    type: sum
    sql: ${TABLE}.target_amount ;;
  }

Updated: changed sum to sum_distinct

  measure: target_amount {
    type: sum_distinct
    sql: ${TABLE}.target_amount ;;
  }
Top Labels in this Space
Top Solution Authors