Loading files
19685617cThis file is pinned to the selected release. Download the original to open it in your design tool.
Files from this revision, including CAD and LFS contents. Git history is not included.
Or in GitHub Desktop, choose File → Clone repository → URL and paste this address.
Public repositories can be cloned without signing in. For pushing, use your ThingAtlas username and a Git access token as the password.
git lfs install git clone https://thingatlas.com/git/-unclaimed/openharness-1322671404.git
Includes Git history, branches, and Git LFS files. Clones the repository’s default branch, regardless of the version shown here.
WITH eligible AS (
SELECT t.*, quantity * unit_price_cents - discount_cents - refund_cents AS net
FROM transactions t JOIN products p ON t.product_id = p.product_id
WHERE status = 'completed' AND (:region = '' OR region = :region)
AND substr(sold_on, 1, 7) IN (substr(:baseline,1,7), substr(:comparison,1,7))
), totals AS (
SELECT coalesce(sum(CASE WHEN substr(sold_on,1,7) = substr(:baseline,1,7) THEN net ELSE 0 END),0) AS b,
coalesce(sum(CASE WHEN substr(sold_on,1,7) = substr(:comparison,1,7) THEN net ELSE 0 END),0) AS c,
count(*) AS n FROM eligible
)
SELECT b AS baseline_sales, c AS comparison_sales, c-b AS change,
(c-b)*1.0/nullif(abs(b),0) AS growth, n AS completed_lines FROM totals;
19685617cThis file is pinned to the selected release. Download the original to open it in your design tool.