Saturday, 12 November 2016

Where to type your DAX queries in SSMS and Excel

New to DAX querying and wondering where you are meant to type in your code? This is the post for you.

SSMS prior to 2017

Before one of the update to SSMS in 2017, you would have to type your DAX query into the MDX query window. Odd, huh? After the update, SSMS provided you with a seperate DAX query window. But if you still have an old version of SSMS, here is what you do:

In SSMS, click the Connect button in Object Explorer > right click the database you want to query > click New Query > select MDX > now start typing your DAX code. Yup, you read it right. You type DAX into the MDX query window and click Execute (or press F5)

Be careful with the Cube pane on the left - if you drag columns over from this pane the code will appear in the MDX language, not DAX. To query with DAX you have to type it manually.

Excel 2016

In Excel 2016, select the Data tab on the ribbon > click New Query > click From Database > click From SQL Server Analysis Services Database > type the server name and the database name > select the drop down arrow beneath to allow you to type your DAX query.

To edit your DAX query in Excel 2016, select the Data tab on the ribbon > click Show Queries > hover the mouse over the query (do not click) > click Edit > click the cog symbol next to Source on the right under Applied Steps > edit your DAX query.


No comments:

Post a Comment