SQLBI's recent YouTube video breaks down a common point of confusion for Power BI developers: when and why to use VALUES() while iterating a table reference in DAX. The presenter clarifies that DAX does not implement a JavaScript-style .values() method, yet the idea of extracting distinct values during iteration is central to many DAX patterns. Consequently, the video focuses on how DAX’s own functions and virtual tables achieve similar goals, and why developers should choose one approach over another. Overall, the content aims to help readers avoid conceptual mix-ups and to improve both correctness and performance.
The video from SQLBI opens by separating the JavaScript mental model from the DAX mental model, which helps set realistic expectations. It then demonstrates practical examples where iterating over distinct values matters for calculations such as running totals, group-level measures, or conditional aggregation. Importantly, the presenter highlights that iteration in DAX relies on functions with row-wise evaluation semantics, rather than on object methods familiar to JavaScript developers. Thus, the core message is that understanding DAX’s functional tools leads to clearer, faster measures.
In the video, SQLBI explains that VALUES() in DAX returns a table of distinct values from a column or a one-column table when used in an expression, and that its behavior depends on the current filter context. The author contrasts this with a JavaScript .values() mindset, which can lead developers to expect in-place iteration or object-like behavior that DAX does not provide. As a result, the video encourages viewers to think in terms of virtual tables and filter contexts rather than procedural loops. This shift in thinking reduces bugs that stem from misapplied patterns.
SQLBI demonstrates practical iteration using functions like SUMX and AVERAGEX, showing how they evaluate an expression for each row of a supplied table or virtual table. Furthermore, the video covers how FILTER and CALCULATE help to sculpt the rows available for iteration by changing the filter context during evaluation. Consequently, combining these functions allows complex, row-aware logic that would otherwise require cumbersome workarounds. The presenter also stresses the value of creating small virtual tables that limit cardinality before iterating.
As the video notes, developers must balance readability and maintainability against raw performance when choosing iteration techniques. For example, using VALUES() or DISTINCT can make logic clearer by explicitly showing the set of items to iterate, yet those choices may increase intermediate memory usage on large models. Conversely, highly optimized expressions that avoid creating intermediate tables can run faster but become harder to understand and maintain. Therefore, SQLBI recommends starting with readable DAX, then profiling and optimizing only where performance issues appear.
The presenter addresses several practical challenges, including context transition, handling BLANK values, and managing high cardinality columns. For instance, VALUES() can return unexpected BLANK rows when filters remove all values, which changes measure behavior unless handled deliberately. Additionally, iterating over columns with millions of distinct values risks heavy memory use or slower query plans, so the video suggests summarizing or grouping first. Finally, SQLBI emphasizes testing edge cases and validating results after refactoring measures.
To conclude, SQLBI offers straightforward recommendations: use VALUES() when you need a distinct set that respects the current filter context, prefer virtual tables to control cardinality, and choose iterating X functions for row-wise logic. Then, test performance using available profiling tools and refactor only when necessary so that clarity is not sacrificed needlessly. The video also encourages learners to study virtual table patterns and to practice on representative data sets to understand tradeoffs. Ultimately, the goal is to write correct, maintainable measures that scale for real-world reports.
From an editorial perspective, the video provides a useful bridge between conceptual misunderstandings and practical DAX usage. By combining examples, clear explanations, and performance-minded tips, SQLBI helps viewers reconcile different programming mental models and apply the right DAX constructs. Consequently, this resource is valuable for both intermediate authors who want fewer surprises and advanced authors who need to validate performance choices. In short, the video sharpens judgment for when to use VALUES() and when to prefer alternative patterns.
Power BI DAX .values() JavaScript iterate, DAX .values function tutorial, Iterate DAX values with JavaScript, Power BI JavaScript API DAX examples, DAX iteration techniques, Power BI custom visual iterate values, Optimize DAX .values performance, Use .values() in Power BI measures