Loading files
15ae7b724This 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.
15ae7b724This file is pinned to the selected release. Download the original to open it in your design tool.
WITH category_totals AS (
SELECT p.category,
sum(CASE WHEN substr(t.sold_on,1,7)=substr(:baseline,1,7) THEN t.quantity*t.unit_price_cents-t.discount_cents-t.refund_cents ELSE 0 END) AS b,
sum(CASE WHEN substr(t.sold_on,1,7)=substr(:comparison,1,7) THEN t.quantity*t.unit_price_cents-t.discount_cents-t.refund_cents ELSE 0 END) AS c
FROM transactions t JOIN products p ON t.product_id=p.product_id
WHERE t.status='completed' AND (:region='' OR t.region=:region)
AND substr(t.sold_on,1,7) IN (substr(:baseline,1,7),substr(:comparison,1,7))
GROUP BY p.category
)
SELECT category, b AS baseline_sales, c AS comparison_sales, c-b AS change
FROM category_totals ORDER BY change DESC, category;