In Excel I make an Analysis Services connection to a data cube. I would like to be able to show a user how current the data is by showing them when the last cube processing
You could use the CubeInfo procedures from the AS StoredProcedures project on Codeplex. You would have to deploy the assembly that you can download there to your server, and then define measures similar to those described in the WITH
clauses of the query at the bottom of the above referenced page.
All the source code of the stored procedures is available at CodePlex as well.
I use the following VBA to place current date-time into a cell in the spreadsheet whenever any pivot table (which includes those populated from SSAS) is updated:
Private Sub Workbook_SheetPivotTableUpdate(ByVal Sh As Object, ByVal Target As PivotTable)
Range("Documentation!B3").Value = Now()
End Sub
This captures the time when the spreadsheet extracted data from the cube rather than the time the cube was processed, but perhaps may be of some help to you.
I had the same need on a project, to show cube last processed date/time in Excel. This may be a little hokie but it definitely works. I added a query against my database in my DSV (technically I made a view since all of my source data came from views rather than named queries or tables) that was just
Select CURRENT_TIMESTAMP as CubeLastRefreshed
I made it a dimension that is related to nothing. Then users can pull it into Excel. You can make a pivot table with just that in it. Or you can write a cube function in Excel to show it at the bottom of the report. It would look something like
=cubemember("Cube","[Cube Process Date].[Cube Last Processed].firstchild")
Just make sure to pay attention to when this dimension gets processed. If you only process certain dimensions or measures on certain days, make sure processing of this dimension is included in the correct places.
I actually found a way to do it in Excel without having to create any views or new measures. In Excel 2013, PowerPivot allows you to create your own custom MDX queries against a cube. You can open PowerPivot, make the connection to your cube, paste in the MDX query I used in SSMS to return the cube process time,
SELECT LAST_DATA_UPDATE FROM $system.mdschema_cubes
and then export this to a pivot table. I did not need to modify anything outside of Excel. Here is a document with step by step procedures.