Skip to content

Commit

Permalink
Rework cents_to_dollars for BQ syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenwindflower committed Mar 28, 2024
1 parent 62ca685 commit ac45a61
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions macros/cents_to_dollars.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{# A basic example for a project-wide macro to cast a column uniformly #}

{% macro cents_to_dollars(column_name, precision=2) -%}
(cast({{ column_name }} / 100 as numeric(16, {{ precision }})))
{% macro cents_to_dollars(column_name) -%}
round(cast(({{ column_name }} / 100) as numeric), 2)
{%- endmacro %}

0 comments on commit ac45a61

Please sign in to comment.