O'Reilly logo

MDX with Microsoft SQL Server 2008 R2 Analysis Services: Cookbook by Tomislav Piasevoli

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Calculating the YTD (Year-To-Date) value

In this recipe we will look at how to calculate the YTD value of another measure, that is, the accumulated value of all dates in a year up to the current member of that date dimension. In addition to that, we'll cover common exceptions and problems.

Getting ready

Start SQL Server Management Studio and connect to your SSAS 2008 R2 instance. Click on the New Query button and check that the target database is Adventure Works DW 2008R2.

In order for this type of calculation to work, we need a dimension marked as Time in the Type property in Dimension Structure tab of BIDS. That should not be a problem because almost every database contains at least one such dimension and Adventure Works is no exception here. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required