PageSourceSearch

https://weiser.ai/assets/js/b192b259.a2eb6574.js

js weiser.ai collected 2026-10-05 15:58:55 UTC 10,510 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkdocusaurus=self.webpackChunkdocusaurus||[]).push([[247],{6353:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>t,contentTitle:()=>c,default:()=>o,frontMatter:()=>d,metadata:()=>i,toc:()=>a});const i=JSON.parse('{"id":"check-types/sum","title":"Sum Check","description":"The sum check validates the sum of a numeric column. This is a specialized version of the numeric check optimized for sum aggregations.","source":"@site/docs/check-types/sum.md","sourceDirName":"check-types","slug":"/check-types/sum","permalink":"/docs/check-types/sum","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"Numeric Check","permalink":"/docs/check-types/numeric"},"next":{"title":"Min Check","permalink":"/docs/check-types/min"}}');var r=s(4848),l=s(8453);const d={},c="Sum Check",t={},a=[{value:"Configuration",id:"configuration",level:2},{value:"Examples",id:"examples",level:2},{value:"Basic Sum Check",id:"basic-sum-check",level:3},{value:"Sum with Filter",id:"sum-with-filter",level:3},{value:"Sum by Dimensions",id:"sum-by-dimensions",level:3},{value:"Sum with Time Dimension",id:"sum-with-time-dimension",level:3},{value:"Multiple Dimensions",id:"multiple-dimensions",level:3},{value:"Use Cases",id:"use-cases",level:2},{value:"Generated SQL",id:"generated-sql",level:2},{value:"Example Results",id:"example-results",level:2},{value:"Data Types",id:"data-types",level:2},{value:"NULL Handling",id:"null-handling",level:2},{value:"Performance Tips",id:"performance-tips",level:2},{value:"Related Checks",id:"related-checks",level:2}];function h(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,l.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"sum-check",children:"Sum Check"})}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"sum"})," check validates the sum of a numeric column. This is a specialized version of the numeric check optimized for sum aggregations."]}),"\n",(0,r.jsx)(n.h2,{id:"configuration",children:"Configuration"}),"\n",(0,r.jsxs)(n.table,{children:[(0,r.jsx)(n.thead,{children:(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.th,{children:"Parameter"}),(0,r.jsx)(n.th,{children:"Required"}),(0,r.jsx)(n.th,{children:"Description"})]})}),(0,r.jsxs)(n.tbody,{children:[(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"name"})}),(0,r.jsx)(n.td,{children:"Yes"}),(0,r.jsx)(n.td,{children:"Unique name for the check"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"dataset"})}),(0,r.jsx)(n.td,{children:"Yes"}),(0,r.jsx)(n.td,{children:"Table name or SQL query"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"type"})}),(0,r.jsx)(n.td,{children:"Yes"}),(0,r.jsxs)(n.td,{children:["Must be ",(0,r.jsx)(n.code,{children:"sum"})]})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"measure"})}),(0,r.jsx)(n.td,{children:"Yes"}),(0,r.jsx)(n.td,{children:"Column name to sum"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"condition"})}),(0,r.jsx)(n.td,{children:"Yes"}),(0,r.jsx)(n.td,{children:"Comparison operator"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"threshold"})}),(0,r.jsx)(n.td,{children:"Yes"}),(0,r.jsx)(n.td,{children:"Value to compare against"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"dimensions"})}),(0,r.jsx)(n.td,{children:"No"}),(0,r.jsx)(n.td,{children:"Group by columns"})]}),(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:(0,r.jsx)(n.code,{children:"filter"})}),(0,r.jsx)(n.td,{children:"No"}),(0,r.jsx)(n.td,{children:"WHERE clause conditions"})]})]})]}),"\n",(0,r.jsx)(n.h2,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(n.h3,{id:"basic-sum-check",children:"Basic Sum Check"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",children:"- name: total_revenue\n  dataset: orders\n  type: sum\n  measure: order_amount\n  condition: ge\n  threshold: 1000000\n"})}),"\n",(0,r.jsx)(n.p,{children:"This check ensures total revenue is at least $1M."}),"\n",(0,r.jsx)(n.h3,{id:"sum-with-filter",children:"Sum with Filter"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",children:"- name: completed_orders_revenue\n  dataset: orders\n  type: sum\n  measure: order_amount\n  condition: gt\n  threshold: 500000\n  filter: status = 'completed'\n"})}),"\n",(0,r.jsx)(n.p,{children:"This check validates that completed orders total more than $500K."}),"\n",(0,r.jsx)(n.h3,{id:"sum-by-dimensions",children:"Sum by Dimensions"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",children:"- name: revenue_by_region\n  dataset: sales\n  type: sum\n  measure: revenue\n  dimensions: [regi
1on]\n  condition: ge\n  threshold: 100000\n"})}),"\n",(0,r.jsx)(n.p,{children:"This check ensures each region has at least $100K in revenue."}),"\n",(0,r.jsx)(n.h3,{id:"sum-with-time-dimension",children:"Sum with Time Dimension"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",children:"- name: daily_sales_sum\n  dataset: transactions\n  type: sum\n  measure: amount\n  condition: gt\n  threshold: 10000\n  time_dimension:\n    name: transaction_date\n    granularity: day\n"})}),"\n",(0,r.jsx)(n.p,{children:"This check validates daily sales exceed $10K."}),"\n",(0,r.jsx)(n.h3,{id:"multiple-dimensions",children:"Multiple Dimensions"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",children:"- name: product_sales_by_region_quarter\n  dataset: sales\n  type: sum\n  measure: sales_amount\n  dimensions: [region, product_category, quarter]\n  condition: ge\n  threshold: 25000\n"})}),"\n",(0,r.jsx)(n.p,{children:"This check ensures each region/product/quarter combination has at least $25K in sales."}),"\n",(0,r.jsx)(n.h2,{id:"use-cases",children:"Use Cases"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Revenue Validation"}),": Ensure minimum revenue targets"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Financial Controls"}),": Validate total amounts in accounting"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Performance Monitoring"}),": Track sum metrics over time"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Data Quality"}),": Ensure calculated totals are reasonable"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Business Rules"}),": Validate sum-based business requirements"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"generated-sql",children:"Generated SQL"}),"\n",(0,r.jsx)(n.p,{children:"The sum check generates SQL like:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-sql",children:"SELECT SUM(order_amount)\nFROM orders\nWHERE status = 'completed'\n"})}),"\n",(0,r.jsx)(n.p,{children:"With dimensions:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-sql",children:"SELECT region, SUM(revenue)\nFROM sales\nGROUP BY region\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example-results",children:"Example Results"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"\u2713 total_revenue: 1250000 (\u2265 1000000)\n\u2717 completed_orders_revenue: 450000 (> 500000)\n\u2713 revenue_by_region_east: 125000 (\u2265 100000)\n\u2713 revenue_by_region_west: 175000 (\u2265 100000)\n"})}),"\n",(0,r.jsx)(n.h2,{id:"data-types",children:"Data Types"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"measure"})," column should be numeric. Common types include:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"INTEGER"})}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"DECIMAL"})," / ",(0,r.jsx)(n.code,{children:"NUMERIC"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"FLOAT"})," / ",(0,r.jsx)(n.code,{children:"DOUBLE"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"MONEY"})," (database-specific)"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"null-handling",children:"NULL Handling"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"SUM()"})," ignores NULL values automatically"]}),"\n",(0,r.jsxs)(n.li,{children:["If all values are NULL, ",(0,r.jsx)(n.code,{children:"SUM()"})," returns NULL"]}),"\n",(0,r.jsx)(n.li,{children:"Consider using filters or data cleaning if NULL handling is critical"}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"performance-tips",children:"Performance Tips"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Indexes"}),": Ensure the measure column has appropriate indexes"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Partitioning"}),": Use time-based partitioning for large datasets"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Filters"}),": Apply filters to reduce data volume"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Materialized Views"}),": Pre-calculate sums for frequently checked aggregations"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"related-checks",children:"Related Checks"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.a,{href:"/docs/check-types/numeric",children:(0,r.jsx)(n.strong,{children:"Numeric"})})," - More flexible numeric expressions"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.a,{href:"/docs/check-types/min",children:(0,r.jsx)(n.strong,{children:"Min"})})," - Minimum value validation"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.a,{href:"/docs/check-types/max",children:(0,r.jsx)(n.strong,{children:"Max"})})," - Maximum value validation"]}),"\n"]})]})}function o(e={}){const{wrapper:n}={...(0,l.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>d,x:()=>c});var i=s(6540);const r={},l=i.createContext(r);function d(e){const n=i.useContext(l);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:d(e.components),i.createElement(l.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.