O'Reilly logo

Microsoft Tabular Modeling Cookbook by Paul te Braak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Deriving tables and selecting top n records

As a comparison to DAX, SQL is a mature language that has a variety of mechanisms for temporarily defining and using tables. One of the reasons for using this type of feature is that a result may need to be pre-computed before it is applied in the outer constructs of a query.

Consider the situation of accumulating sales based on the sales values' ranks, as shown in the following screenshot:

Deriving tables and selecting top n records

This type of query must pre-compute values before they can be used. Logically, the query must determine each customer's sales value, then rank the customers based on that value, and then (finally) determine (on a row-by-row ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required