Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MDX Query Help-- Calculate running total

Status
Not open for further replies.

rmuzam

Programmer
Jun 25, 2004
3
CA
Hello

I have a Fact table in my Warehouse database containing data since
2001 till today. This table is a source table for a Cube also. In this
cube, I want to creata a "Calculated measure" displaying running-total
of the "Quantity" field starting Jan 01, 2003 till today. For dates
before Jan 01, 2003 ,I want to show NULL in this calculated measure.

I have written the following MDX query.

sum(
{StrToMember
(iif(
[time].currentmember.level is [Time].[Day Of Week],"[Time].[Retail
Year].&[2003].&[1].&[1].&[2]",
iif([Time].currentmember.level is [Time].[Retail Week Description],
"[Time].[Retail Year].&[2003].&[1].&[1]",
iif([Time].currentmember.level is [Time].[Retail Month Description],
"[Time].[Retail Year].&[2003].&[1]",
iif([Time].currentmember.level is [Time].[Retail Year],
"[Time].[Retail Year].&[2003]","[Time].[All Time]")) ) ) ):
StrToMember([time].currentmember.uniquename)}
,[Measures].[Quantity])


The problem is that this MDX query fails to show NULL for dates before
Jan 01, 2003. In fact it calculates "negative sum" for the dates
before Jan 01, 2003.

Could anyone please help.
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top