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!

calculated measure -- aggregating sales data by set time constraints

Status
Not open for further replies.

rgaertner

MIS
Sep 24, 2003
1
US
I'm trying to create a calculated measure that will aggregate sales data for each Monday in the 1st week of the month. I was able to calculate the total using the SQL formula below, but was wondering if anyone had the MDX equivalent?

set @mon1sales = (select sum(sales) as totalsales from salestable1, Dim_Calendar_Date2 where salestable1.start_date = Dim_Calendar_Date2.FullSQLDate and datepart(dw, salestable1.start_date) = 2 and Dim_Calendar_Date2.PositioninMonth = 1)

Thanks.
 
Hello, you may add 2 properties to the levels of your time dimension : "start_date" and "PositioninMonth" and then use the FILTER MDX function to retrieve only the data you want :

something like :
{Filter( [Measures].[SALES_DATA], [TIME].currentmember.propety("start_date") = 2 AND [TIME].currentmember.propety("PositioninMonth") = 1)}

Please check the syntax as I'm writing it directly there ...
A+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top