Book Image

Microsoft SQL Server 2014 Business Intelligence Development Beginner's Guide

By : Abolfazl Radgoudarzi, Reza Rad
Book Image

Microsoft SQL Server 2014 Business Intelligence Development Beginner's Guide

By: Abolfazl Radgoudarzi, Reza Rad

Overview of this book

Table of Contents (19 chapters)
Microsoft SQL Server 2014 Business Intelligence Development Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – using time intelligence functions in DAX


In this example, we will create some measures such as year-to-date, quarter-to-date, fiscal year-to-date, and running total, in order to show you how to use DAX functions and create expressions as you wish. As part of this example, we will use the CALCULATE function, which calculates an expression on a filter context. So, perform the following steps that show the use of time intelligence functions:

  1. Go to Grid View of the InternetSales table and add a new measure using the following expression, and change the format string of this measure to Currency:

    Sales Amount YTD:=TOTALYTD(SUM(InternetSales[SalesAmount]),'Date'[FullDateAlternateKey])
  2. Save the changes and analyze the model in Excel. Select Calendar under Date, and Sales Amount YTD and Sum of SalesAmount under measures. You will see that the new measure is shown but it is not correct (look at the next screenshot). The problem is that the YTD is not calculated correctly; it is because...