-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly join calculated number of parcels per sale to sales view #334
Correctly join calculated number of parcels per sale to sales view #334
Conversation
Reviewing the data sent by Bill, it seems some sales were getting filtered out during ingest by the
|
@@ -130,7 +130,8 @@ unique_sales AS ( | |||
) AS sale_filter_deed_type | |||
FROM {{ source('iasworld', 'sales') }} AS sales | |||
LEFT JOIN calculated | |||
ON sales.instruno = calculated.instruno | |||
ON NULLIF(REPLACE(sales.instruno, 'D', ''), '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calculated AS (
SELECT
instruno,
COUNT(*) AS nopar_calculated
FROM (
SELECT DISTINCT
parid,
NULLIF(REPLACE(instruno, 'D', ''), '') AS instruno
FROM {{ source('iasworld', 'sales') }}
WHERE deactivat IS NULL
AND cur = 'Y'
)
GROUP BY instruno
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeeep, that'll do it. We'll need to re-ingest sales for modeling.
Count of number of sales with <= 2 for number of parcels per sale now vs NULL previously:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright @wrridgeway, this looks good to go. We'll need to re-export some things. See email for full follow-ups.
@@ -130,7 +130,8 @@ unique_sales AS ( | |||
) AS sale_filter_deed_type | |||
FROM {{ source('iasworld', 'sales') }} AS sales | |||
LEFT JOIN calculated | |||
ON sales.instruno = calculated.instruno | |||
ON NULLIF(REPLACE(sales.instruno, 'D', ''), '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeeep, that'll do it. We'll need to re-ingest sales for modeling.
Joining calculated number of sales currently uses an adjusted document number against an un-adjusted document number.