Skip to content

Commit 48d079b

Browse files
even-weikentwelcome
authored andcommitted
Add rounding effect analysis
Signed-off-by: Even Wei <[email protected]>
1 parent 4cc8e66 commit 48d079b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

models/rounding_effect.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
SELECT
2+
order_id,
3+
ROUND(amount) AS rounded_amount_dollar,
4+
amount_cent,
5+
(ROUND(amount) * 100 - amount_cent) AS rounding_difference_cents
6+
FROM {{ ref('stg_payments') }}

models/staging/stg_payments.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ renamed as (
1616
payment_method,
1717

1818
-- `amount` is currently stored in cents, so we convert it to dollars
19-
amount / 100 as amount
19+
amount / 100 as amount,
20+
amount as amount_cent
2021

2122
from source
2223

0 commit comments

Comments
 (0)