question

jgpage avatar image
jgpage asked

MDX .LastChild does not appear to work like .FirstChild

I am attempting to write an MDX query that returns the last value for each "key" in my set. I have a query that returns the first value : SELECT { [Measures].[Num Val] } ON COLUMNS , ( [Trans].[Tax Year].Children, [Trans].[TRA].Children, [Trans].[Seq].FirstChild ) ON ROWS FROM [TransHist] Which returns: Num Val 2012 TRA-1 1 5 2012 TRA-2 1 5 2012 TRA-3 1 3 as expected (and desired). When I change .FirstChild to .LastChild the query returns: Num Val 2012 TRA-1 4 11 I expected two additional rows. This query: select { [Measures].[Num Val] } ON COLUMNS , ( [Trans].[Tax Year].Children, [Trans].[TRA].Children, [Trans].[Seq].Children ) on rows from TransHist returns: Num Val 2012 TRA-1 1 5 2012 TRA-1 2 6 2012 TRA-1 3 8 2012 TRA-1 4 11 2012 TRA-2 1 5 2012 TRA-2 2 6 2012 TRA-3 1 3 which is everything. I get results the same as the .LastChild results when I use BottomCount() and Tail(). My ultimate goal is to get results that look like: Num Val 2012 TRA-1 1 5 2012 TRA-1 4 11 2012 TRA-2 1 5 2012 TRA-2 2 6 2012 TRA-3 1 3 2012 TRA-3 1 3 This will allow me to perform a delta between the first and last "Num Val" in a report. Any ideas or suggestions would be appreciated.
ssasmdx
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.