Evaluate a table expression using “calculatetable”

In this post I will give you some samples on how to use the “calculatetable” function. In MSDN it is described as “Evaluates a table expression in a context modified by the given filters”. This function will always return all the columns in the table. And you have the possibility to add new columns and add filters.

Lets take a look at some examples:

EVALUATE
CALCULATETABLE ( 'Internet Sales' )

The code above will basically give you all the columns and all the rows in the “Internet Sales” table. This will be equal to a “select * from table” in SQL.

In the next sample I will show you how to filter the resultset in “calculatetable”

EVALUATE
CALCULATETABLE (
    'Internet Sales',
    'Date'[Calendar Year] = 2005,
    'Internet Sales'[ProductKey] = 314
)

As you can see here I have added filters for year 2005 and productkey 314.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s