Hi Friends i have small doubt in mdx query.
Here Cube Name :Testcube....> its having measures expected,payment.
dimensions: dimpatient: its having attribute is pn
Dimprcode: its having attribute is prcode
Dimdate: its having attribute is dos
based on this attributes and measures for one pn having sample data like below
pn prcode dos Expected Payment
MS0000003 PT001 1/2/2013 29.72 0
MS0000003 PT001 1/21/2013 57.1 0
MS0000003 PT002 6/7/2013 26.69 0
MS0000003 PT002 6/7/2013 89.16 0
MS0000003 PT002 6/6/2013 57.1 0
MS0000003 PT002 6/7/2013 12.28 0
MS0000003 PT002 6/7/2013 26.69 26.69
MS0000003 PT002 6/7/2013 89.16 77.16
MS0000003 PT002 6/17/2013 57.1 57.1


Last DOS: max dos based on prcode wise

LOS Dayslast dos-first dos) this is for based on prcode wise
expected:sum of expected amount based on prcode and dos
payment:sum of payment amount based on prcode and dos

Based on this data i required output like below
pn prcode maxdos list of servicedays(max of dos-min of dos) Expected Payment
MS0000003 PT001 1/21/2013 19 86.82 0
MS0000003 PT002 6/17/2013 11 358.18 160.98

Please tell me how to write mdx query based on this cube .