Getting values on the last date with data

In this recipe we are going to learn how to get the value of a measure on the last date with data. If you haven't read the previous recipe, do so before reading this one as this recipe continues where the previous recipe stopped.

Getting ready

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

In this example, we are going to use the simplified version of the query from the previous chapter, simplified in the sense that it has only one measure, the time-sensitive measure:

WITH MEMBER [Measures].[Last existing date] AS Max( EXISTING [Date].[Date].[Date].MEMBERS, iif( [Measures].[Internet Order ...

Get MDX with Microsoft SQL Server 2016 Analysis Services Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.