Monthly Function
hello, i'm kinda new on mdx , wondering if me came across with. have current month, next month, etc calculated automatically depending on today's date.
below can find mdx query have @ momment, can me issue?
with
member
[total qty backlog] as [measures].[sales order release our req qty]member
[current month] as ([sales order release need date].[month attribute].&[200803],[measures].[sales order release our req qty])
member
[next month] as ([sales order release need date].[month attribute].&[200804],[measures].[sales order release our req qty])
member
[month 2] as ([sales order release need date].[month attribute].&[200805],[measures].[sales order release our req qty])
member
[month 3] as ([sales order release need date].[month attribute].&[200806],[measures].[sales order release our req qty])
member
[month 4] as ([sales order release need date].[month attribute].&[200807],[measures].[sales order release our req qty])
member
[month 5] as ([sales order release need date].[month attribute].&[200808],[measures].[sales order release our req qty])
member
[month 6] as ([sales order release need date].[month attribute].&[200809],[measures].[sales order release our req qty])
select
non
empty {[customer group].[customer group hierarchy]
}
on rows,
non empty {on columns[total qty backlog],
[current month],
[next month],
[month 2],
[month 3],
[month 4],
[month 5],
[month 6]
}
from
[orders-2c096193-3e36-41a2-b99d-5f43466b4f45]
note: query based march 2009 being current month.
if you want query be relative single month, put in clause , calculate else relative that
with
member
[total qty backlog] as [measures].[sales order release our req qty]member
[current month] as ([measures].[sales order release our req qty])member
[next month] as ([sales order release need date].[month attribute].currentmember.lead(1),[measures].[sales order release our req qty])
member
[month 2] as ([sales order release need date].[month attribute]..currentmember.lead(2),[measures].[sales order release our req qty])
member
[month 3] as ([sales order release need date].[month attribute]..currentmember.lead(3),[measures].[sales order release our req qty])
member
[month 4] as ([sales order release need date].[month attribute]..currentmember.lead(4),[measures].[sales order release our req qty])
member
[month 5] as ([sales order release need date].[month attribute]..currentmember.lead(5),[measures].[sales order release our req qty])
member
[month 6] as ([sales order release need date].[month attribute]..currentmember.lead(6),[measures].[sales order release our req qty])
select
non
empty {[customer group].[customer group hierarchy]
}
on rows,
non empty {on columns[total qty backlog],
[current month],
[next month],
[month 2],
[month 3],
[month 4],
[month 5],
[month 6]
}
from
[orders-2c096193-3e36-41a2-b99d-5f43466b4f45]where [sales order release need date].[month attribute].&[200803]
SQL Server > SQL Server Analysis Services
Comments
Post a Comment