SShortSingh.
Back to feed

SUM vs SUMX in DAX: How to Choose the Right Aggregation Function

0
·4 views

Data analyst Michael Nocito published a practical guide on August 10, 2026, explaining the key difference between SUM and SUMX in Microsoft's DAX formula language. SUM is used when values already exist in a column, while SUMX is an iterator that calculates a value row by row before aggregating the results. Using SUM where SUMX is required — such as multiplying units by unit price per order — can produce inflated figures by combining values across unrelated rows. Nocito illustrates this with a 16-order sample dataset and a grid diagram showing how the wrong function creates hundreds of false pairings versus the correct diagonal of matched row values. All results in the guide are verified against Microsoft's official DAX reference documentation.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Next.js 15 Introduces next/form to Eliminate Search UI Boilerplate

Next.js 15 has shipped a built-in Form component, next/form, designed to replace the repetitive manual code developers typically write for search and filtering interfaces. Previously, implementing URL-based search in React required managing state hooks, custom submit handlers, query string construction, and router navigation calls. The new component handles URL encoding, client-side navigation, and prefetching automatically, reducing complex implementations to just a few lines. It also supports progressive enhancement, falling back to a standard HTML GET request when JavaScript is unavailable or slow to load. Additionally, next/form integrates with Server Actions for mutation use cases and prefetches target page resources as soon as the form enters the viewport.

0
ProgrammingDEV Community ·

Contribution Margin vs Break-Even: Why Fixed Costs Must Stay Out of Unit Math

Data analyst Michael Nocito published an explainer on August 11, 2026, addressing two widely misunderstood financial concepts: contribution margin and break-even analysis. The core argument is that fixed costs, such as factory rent, should never be allocated inside a per-unit calculation, as doing so dramatically distorts the break-even result. Contribution margin is defined as selling price minus variable costs only, where variable costs are those that rise with each additional unit sold. Dividing total fixed costs by the contribution margin then yields the true break-even unit count. Nocito illustrates the error with a worked example showing how misplacing fixed costs can inflate a break-even answer from roughly 750 units to 12,000 units.

0
ProgrammingDEV Community ·

Why Formal Verification Forces Developers to Work Outside Their Main Language

Formal verification tools require developers to specify program behavior using preconditions, postconditions, and loop invariants — concepts rarely encountered in everyday software work. Unlike unit tests that return a concrete failing example, verifiers often respond with timeouts or cryptic solver errors, making debugging far harder. Landmark projects illustrate the scale involved: the seL4 microkernel's correctness proof in Isabelle/HOL grew to roughly 480,000 lines for an 8,700-line C kernel. Tools like Rustan Leino's auto-active verification have reduced some friction by letting developers add assertions and lemmas inside their editor, but the proof still amounts to a separate codebase in a separate language. For most teams, this overhead — learning new specification languages while simultaneously learning tool-specific error patterns — represents a significant barrier to adoption.