I have an MDX query:
SELECT
NON EMPTY {Hierarchize({[Measures].[Rating]})} ON COLUMNS,
NON EMPTY {Hierarchize({[Response].[Response Name].Members})} ON ROWS
FROM [Ratings]
That returns a table of Response Names to Response count. This query returns a row for ALL responses, though, and I just want the most recent 10 responses.
I tried to do this using HEAD like so:
SELECT
NON EMPTY {Hierarchize({[Measures].[Rating]})} ON COLUMNS,
HEAD(NON EMPTY {Hierarchize({[Response].[Response Name].Members})}, 10) ON ROWS
FROM [Ratings]
but it gives an error "Syntax error at line 3, column 18, token 'NON'"
If I remove the NON EMPTY, then it works as I would expect (returns only 10 members), but then it includes the empty Ratings.
How can I use NON EMPTY and HEAD together? (Or accomplish the same thing another way)
Head
will return the 'first n' elements in a set, which may or may not coincide with 'most recent'. You can use theOrder
function in addition toHead
to return what you need reliably. – Ezequiel Muns