views:

239

answers:

2

I am trying to match existing reporting functionality while building up a new cube for a Proof of Concept.

Can I retrieve data from my cube using an MDX query and put it into a recordset so I can then populate an Excel Sheet with the data?

+1  A: 

Have you considered attaching from Excel directly to Analysis Services, and using the built-in drag-and-drop query functionality? Excel will generate the MDX for you.

I've never done it, but it should be possible to integrate ADOMD.NET into a VSTO application, which will then run inside Excel. You might also be able to access some of Excel's MDX query machinery directly that way....

RickNZ
Well, an ADoMD recordset comes in the format of a Cubed recordset. Fantastically enough, I actually have a scenario where I need to do flat file extacts out of EXCEL.
Raj More
You could also say that the response to all MDX queries is a "cubed recordset."It's a straightforward process to transform a CellSet (the ADOMD equivalent of a DataSet) into a two-dimensional object. In case it helps, I give a detailed example in my book (Ultra-Fast ASP.NET).
RickNZ
+1  A: 

Best way to work with OLAP and Excel is detailed here: http://stackoverflow.com/questions/49876/simpler-interface-for-sql-server-analysis-services-cubes-for-end-users/70515

If you want to write your own MDX instead of using drag-drop, you can't do this with Excel as far as I know. However, most languages would let you fire off some MDX at a cube, and then you could loop the recordset yourself to create a CSV file.

Or even simpler, use SQL Server's Query Analyser like this, and save the results to a CSV:

SELECT TOP 100 * FROM OPENROWSET('MSOLAP',
'Datasource=MyHotServer;Initial catalog=MyLovelyCube',
'SELECT {dimensions(0).members} ON ROWS, {time.defaultmember} ON COLUMNS FROM sales')

(N.B. If you don't know MDX yet....don't start learning unless you really have to! It isn't as easy as SQL, and you can get away without it usually.)

Magnus Smith