How do you get the last process date for an SSAS Tabular Database? This article shows the techniques you can use and explains how to interpret the information available.
Last Process Date in a Calculated Column
You can create a LastProcessInfo calculated column in a table that contains a simple expression such as:
= NOW()
This calculated column will contain only one value for all the rows of the table, so it does not have a relevant cost in terms of memory, regardless of the table size.
You can create a measure that returns this information in a DAX or MDX query:
LastProcess := MAX ( Table[LastProcessInfo] )
With this approach, you are responsible of updating this column correctly. You need to create the LastProcessInfo calculated column in a table that is always included in any process operation. This will be always ok if you always run a Process Full on the entire database. If other tables are processed, you might provide a wrong information.
Last Process Date from XMLA
You can run an XMLA query that returns information in XML format.
<Discover xmlns="urn:schemas-microsoft-com:xml-analysis"> <RequestType>MDSCHEMA_CUBES</RequestType> <Restrictions/> <Properties> <PropertyList> <Catalog>AdventureWorks Tabular Model SQL 2012</Catalog> </PropertyList> </Properties> </Discover>
The LAST_DATA_UPDATE tag in the result contains the information about the last full process on the entire database. Please note that the date and time provided are in UTC, you have to perform conversion to local time.
<row> <CATALOG_NAME>AdventureWorks Tabular Model SQL 2012</CATALOG_NAME> <CUBE_NAME>Model</CUBE_NAME> <CUBE_TYPE>CUBE</CUBE_TYPE> <LAST_SCHEMA_UPDATE>2013-07-21T10:08:22.913333</LAST_SCHEMA_UPDATE> <LAST_DATA_UPDATE>2014-01-25T07:03:11.01</LAST_DATA_UPDATE> <DESCRIPTION /> <IS_DRILLTHROUGH_ENABLED>true</IS_DRILLTHROUGH_ENABLED> <IS_LINKABLE>true</IS_LINKABLE> <IS_WRITE_ENABLED>false</IS_WRITE_ENABLED> <IS_SQL_ENABLED>true</IS_SQL_ENABLED> <CUBE_CAPTION>Model</CUBE_CAPTION> <CUBE_SOURCE>1</CUBE_SOURCE> <PREFERRED_QUERY_PATTERNS>1</PREFERRED_QUERY_PATTERNS> </row>
You might have several rows in the result, one for each perspective in the tabular database. However, if you process a single partition or table in the database, this information is not updated and you have to use a DMV instead.
Last Process Date from DMV
You can run this DMV query in order to get the last process update of any table in the database.
SELECT TOP 1 [LAST_DATA_UPDATE] FROM $System.MDSCHEMA_CUBES WHERE [catalog_name] = 'AdventureWorks Tabular Model SQL 2012' ORDER BY [LAST_DATA_UPDATE] DESC
You can omit the WHERE condition if you specify the Initial Catalog property in the connection string. Please note that the date and time provided are in UTC, you have to perform conversion to local time. Any process of a table or also a single partition of a table will reflect in an updated LAST_DATA_UPDATE.