Skip to content

Commit

Permalink
Add rounding effect analysis
Browse files Browse the repository at this point in the history
Signed-off-by: Even Wei <shinycockorach@gmail.com>
  • Loading branch information
even-wei authored and popcornylu committed Jun 5, 2024
1 parent 2915805 commit 5eb597b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions models/rounding_effect.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SELECT
order_id,
ROUND(amount) AS rounded_amount_dollar,
amount_cent,
(ROUND(amount) * 100 - amount_cent) AS rounding_difference_cents
FROM {{ ref('stg_payments') }}
3 changes: 2 additions & 1 deletion models/staging/stg_payments.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ renamed as (
payment_method,

-- `amount` is currently stored in cents, so we convert it to dollars
amount / 100 as amount
amount / 100 as amount,
amount as amount_cent

from source

Expand Down

0 comments on commit 5eb597b

Please # to comment.