Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
DAX Cookbook

You're reading from   DAX Cookbook Over 120 recipes to enhance your business with analytics, reporting, and business intelligence

Arrow left icon
Product type Paperback
Published in Mar 2020
Publisher Packt
ISBN-13 9781839217074
Length 552 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Greg Deckler Greg Deckler
Author Profile Icon Greg Deckler
Greg Deckler
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Thinking in DAX 2. Dealing with Dates and Calendars FREE CHAPTER 3. Tangling with Time and Duration 4. Transforming Text and Numbers 5. Figuring Financial Rates and Revenues 6. Computing Customer KPIs 7. Evaluating Employment Measures 8. Processing Project Performance 9. Calculating Common Industry Metrics 10. Using Uncommon DAX Patterns 11. Solving Statistical and Mathematical Formulas 12. Applying Advanced DAX Patterns 13. Debugging and Optimizing DAX 14. Other Books You May Enjoy

Using DAX in Excel, Power BI, and SQL

DAX is the native formula and query language for Microsoft Power Pivot (Excel), Power BI Desktop, and SQL Server Analysis Services (SSAS) tabular models. Thus, DAX can be used in any of these programs.

Getting ready

Ensure that you have Power Pivot for Excel, Power BI Desktop, or an SSAS tabular cube.

How to do it...

Depending upon the program being used, where DAX is entered varies somewhat. Use the following instructions according to the program you are using.

Excel

Perform the following steps to enter DAX in Excel:

  1. Open Excel and create a data model using the Power Pivot tab in the ribbon and then click Add to Data Model. You must have a data model created before you can enter DAX.
  2. To create a measure in Excel, select the Power Pivot tab from the ribbon, and then choose Measures followed by New Measure. A new window called Measure will appear where you can enter a DAX formula in the Formula area.
  1. To create a new calculated column in Excel, select the Power Pivot tab from the ribbon and then Manage. In the Power Pivot window, select Design from the ribbon and then Add in the Columns section. A formula bar will appear just below the ribbon and your cursor will become active in the formula bar.

Power BI

Perform the following steps to enter DAX in Power BI Desktop:

  1. Open Power BI Desktop.
  2. In Power BI Desktop, select the Modeling tab from the ribbon and then choose New Measure | New Column or New Table.

The formula bar will appear just below the ribbon and your cursor will become active in the formula bar.

SQL Server

Perform the following steps to enter DAX in SQL Server:

  1. Open SQL Server Management Studio.
  2. In SQL Server Management Studio, connect to a deployed tabular Analysis Server data model.
  3. Right-click the database in the deployed tabular model and choose New Query and then MDX.
  4. When writing your DAX query, ensure that you begin your query with the EVALUATE keyword.

See also

For more details regarding this recipe, refer to the following links:

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image