﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 7,2000 / SQL Server Newbies  / MDX - SSAS, getting result count of last measurement within a period / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sat, 18 May 2013 23:06:46 GMT</lastBuildDate><ttl>20</ttl><item><title>MDX - SSAS, getting result count of last measurement within a period</title><link>http://www.sqlservercentral.com/Forums/Topic1427234-169-1.aspx</link><description>Hi I am having trouble trying to write some MDX code.I am trying to get the last measurement result pr. person within a period. I have the following measurements and results:[code="plain"]Person      Measurement  result              Date1           1            overweight         2011-01-011           2            Normal             2011-03-012           3            Underweight        2011-01-012           4            Underweight        2011-02-012           5            Normal             2011-03-011           6            overweight         2012-01-01[/code]Right now I am only able to get a normal count on measurements and distinct count on persons. So I can create a table like this (Full period):[code="plain"]           Number of persons            Number of measurementsOverweight       1                       1Normal           2                       3Underweight      1                       2[/code]           But I would like to have only the last category within my chosen period, so it looks like this (Full period):[code="plain"]            Number of persons        Number of measurementsOverweight       1                  1Normal           1                  1Underweight      0                  0[/code]But it should also be able to create a table like this for the period (year 2011)[code="plain"]            Number of persons        Number of measurementsOverweight       0                   0Normal           2                   2Underweight      0                   0[/code]My dimensions and measurements are like the following:[code="plain"][Measures].[Numb persons][Measures].[Numb measurements][Registrationdate].[Date][Person].[ID][result].[Name][/code]I hope someone can help methanks in advance BrJens H</description><pubDate>Wed, 06 Mar 2013 01:42:20 GMT</pubDate><dc:creator>Jens Henrik</dc:creator></item></channel></rss>