WiseOwl Training - Established 1992 Wise Owl Training

Established May 1992
30 years in business
Wise Owl Training
30 years in business
See 529 reviews for our classroom and online training
How to write queries in DAX to interrogate SSAS tabular models
Part eight of an eight-part series of blogs

As well as creating measures to aggregate data in tabular models using DAX, you can also write queries to extract data - this blog shows you how!

  1. Writing DAX queries
  2. DAX and SQL compared
  3. The EVALUATE command in the DAX query language
  4. Using SUMMARIZE to group or aggregate DAX query data
  5. Filtering in DAX queries using CALCULATETABLE or FILTER
  6. Adding columns in a DAX query using ADDCOLUMNS
  7. Combining the results of two or more tables
  8. Other useful DAX functions (this blog)

This blog is part of our online SSAS Tabular tutorial; we also offer lots of other Analysis Services training resources.

Posted by Andy Brown on 12 February 2016

You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Other useful DAX functions

To wrap up this section, I thought I'd show a couple of other potentially useful DAX functions.

Using ROW to Display One Row of Data 

It can be useful when testing DAX to be able to show single values, using the ROW function.  The syntax is:


Name for the first column you want to display,
Calculation expression for this column,


Name for the last column you want to display,
Calculation expression for this column


The ROW function is similar to a SELECT statement in SQL run without a FROM clause.

Here's an example query, listing out the current user name, time and number of products:

-- show the current user and time



"Current user",


"Current time",

FORMAT ( NOW (), "HH:mm:ss" ),

"Number of products",

COUNT ( Product[ProductId] )


This would give these results:

ROW function results

This query would display these 3 bits of information.


Using CONTAINS to Check if a Field Value Exists 

The CONTAINS function has the following syntax, and returns TRUE or FALSE


Name of table to search,

Name for the first column to look in,
Value to look for,


Name of the last column to look in,
Value to look for


Here's an example of the function, showing whether there's a product called Wol with a list price of £3.95 (there is): 

-- look for product with specific

-- name and price



"Does WOL exist?",









Here are the unexciting results from running this query:

Product exists

A product called WOL costing £3.95 does exist in the Product table.


And on that slightly anti-climactic note, I've finished showing the DAX query syntax that I wanted to cover!

This blog has 0 threads Add post