<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Scott</title>
    <description>The latest articles on DEV Community by Scott (@datplan).</description>
    <link>https://dev.to/datplan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4054024%2Fd6c71026-608a-485b-88d3-c3bc98200766.png</url>
      <title>DEV Community: Scott</title>
      <link>https://dev.to/datplan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/datplan"/>
    <language>en</language>
    <item>
      <title>Choose the Reporting Grain Before You Choose the Chart</title>
      <dc:creator>Scott</dc:creator>
      <pubDate>Thu, 30 Jul 2026 20:17:28 +0000</pubDate>
      <link>https://dev.to/datplan/choose-the-reporting-grain-before-you-choose-the-chart-cp6</link>
      <guid>https://dev.to/datplan/choose-the-reporting-grain-before-you-choose-the-chart-cp6</guid>
      <description>&lt;p&gt;A chart can be perfectly formatted and still be wrong. In accounting and operational reporting, the most common cause is not the visual—it is the &lt;strong&gt;grain of the data underneath it&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Grain means what one row represents. One row might be an invoice, an invoice line, a payment, an account balance at a reporting date, a CRM deal, or a single activity. Those are different business events.&lt;/p&gt;

&lt;p&gt;When they are treated as interchangeable, totals multiply, dates lose their meaning, and filters answer a different question from the one in the chart title.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with the business question
&lt;/h2&gt;

&lt;p&gt;Before choosing a table or chart, write the question in one sentence:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;How much is outstanding by customer?&lt;/strong&gt; This is an invoice-level question.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Which products generated net sales?&lt;/strong&gt; This is an invoice-line question.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When did cash arrive?&lt;/strong&gt; This is a payment question.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What was the account balance at month end?&lt;/strong&gt; This is a financial-summary question.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The chart type comes later. A bar chart cannot repair a table that mixes recognised revenue, invoice value, and settlement movement.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four accounting grains that should stay distinct
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Invoice summary
&lt;/h3&gt;

&lt;p&gt;One row per invoice or bill. Use it for document totals, due dates, paid amounts, balances, and customer or supplier analysis.&lt;/p&gt;

&lt;h3&gt;
  
  
  Invoice lines
&lt;/h3&gt;

&lt;p&gt;One row per product or service line. Use it for item, tracking, quantity, net, tax, and gross analysis.&lt;/p&gt;

&lt;h3&gt;
  
  
  Payments
&lt;/h3&gt;

&lt;p&gt;One row per authorised settlement. Use it for cash timing, receipts, supplier payments, and payment accounts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Financial summary
&lt;/h3&gt;

&lt;p&gt;One row per account and reporting period or date. Use it for profit-and-loss, balance-sheet, and account-movement reporting.&lt;/p&gt;

&lt;p&gt;The same organisation can have valid numbers at every one of these grains. The mistake is expecting them to reconcile by simple addition. An invoice amount is not recognised revenue, a payment is not an invoice total, and an invoice line cannot safely carry the full invoice value on every row.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why totals multiply
&lt;/h2&gt;

&lt;p&gt;Suppose one invoice has five lines and a gross value of £1,000. If the invoice total is joined onto every line and then summed, the result is £5,000.&lt;/p&gt;

&lt;p&gt;Nothing is wrong with the underlying records. The model simply repeated an invoice-level measure at a line-level grain.&lt;/p&gt;

&lt;p&gt;The same effect appears in CRM reporting. One deal joined to eight activities produces eight rows. Summing the deal amount across those rows multiplies pipeline value by eight.&lt;/p&gt;

&lt;p&gt;Distinct counts do not solve every version of this problem. A distinct count can correctly count invoices or deals, but it does not make a repeated amount safe to sum. A distinct sum is also unreliable because two legitimate records can have the same value.&lt;/p&gt;

&lt;h2&gt;
  
  
  A safer star-schema pattern
&lt;/h2&gt;

&lt;p&gt;Keep fact tables at their natural grain. Invoice facts, invoice-line facts, payment facts, and financial-summary facts can share dimensions such as date, contact, account, or tracking category, but they do not need to be flattened into one universal fact table.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use stable business keys and surrogate keys consistently.&lt;/li&gt;
&lt;li&gt;Create role-playing date dimensions when invoice date, due date, and payment date answer different questions.&lt;/li&gt;
&lt;li&gt;Keep measures on the fact table where they are naturally additive.&lt;/li&gt;
&lt;li&gt;Document non-additive balances and snapshot measures.&lt;/li&gt;
&lt;li&gt;Build relationships first, then create measures, then choose visuals.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Refreshes need a stable contract
&lt;/h2&gt;

&lt;p&gt;A good model is not only correct once. It should also be refreshable.&lt;/p&gt;

&lt;p&gt;Stable file names, consistent columns, explicit types, clear endpoint results, and a known reporting grain make the refresh predictable. If a source adds data or an endpoint returns a partial result, the run evidence should make that visible before the dashboard is trusted.&lt;/p&gt;

&lt;p&gt;This is why the data-preparation layer matters. It separates source retrieval from the reporting model and gives the analyst a place to validate row counts, dates, totals, and relationships.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical pre-chart checklist
&lt;/h2&gt;

&lt;p&gt;Before building a visual, ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What does one row represent?&lt;/li&gt;
&lt;li&gt;Which date gives the measure its business meaning?&lt;/li&gt;
&lt;li&gt;Is the measure additive across rows, time, and categories?&lt;/li&gt;
&lt;li&gt;Can a join repeat the measure?&lt;/li&gt;
&lt;li&gt;Which table owns the measure?&lt;/li&gt;
&lt;li&gt;What run evidence confirms that the refresh completed as expected?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where Datplan DataPull fits
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.datplan.com/" rel="noopener noreferrer"&gt;Datplan DataPull&lt;/a&gt; uses separate documented reporting grains for authorised business data and prepares local fact-and-dimension exports for BI tools.&lt;/p&gt;

&lt;p&gt;The product does not remove the need to understand the model. It makes the grain and refresh boundary easier to inspect before a polished chart repeats the wrong value.&lt;/p&gt;

&lt;p&gt;For a practical Xero example, see &lt;a href="https://www.datplan.com/blog/xero-star-schema-power-bi/" rel="noopener noreferrer"&gt;How to prepare a Xero star schema for Power BI&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>accounting</category>
      <category>dataengineering</category>
      <category>businessintelligence</category>
      <category>sql</category>
    </item>
  </channel>
</rss>
