MDX日期之间的差值,非空且具有相同维

时间:2018-10-26 15:15:00

标签: mdx

嗨,我需要计算两次计数之间的天数,以便数据集为

count

我创建了最后一个日期的成员,这作为一个开始返回整个数据集中的最后一个日期,但不确定如何继续。在MDX中可以这样做吗?如果是这样怎么办?

谢谢

if [ ${#FOLDER[@]} -ne 0 ]; then
    local files=$(stamp-files ${FOLDER[0]})
    rsync -rvh --delete-after ${files} ${folder_dest}
    for folder in ${FOLDER[@]:1}; do
        rsync -rvh --delete-after ${folder} ${folder_dest}
    done
fi

1 个答案:

答案 0 :(得分:0)

以下示例将有所帮助。但是请注意,它将从本月初算起。因此,如果有一个订单在5月5日,而最后一个订单在4月28日,那么差异将是4而不是7。

with member measures.MonthDate as 
[Date].[Day of Month].CurrentMember.Properties ("Member_Value",TYPED)

member measures.LastOrderDate as 
(max(
FILTER(
[Date].[Day of Month].firstSibling:[Date].[Day of Month].currentmember.lag(1)
,[Measures].[Internet Order Count] > 0)
,measures.MonthDate)
)
member measures.DaysToLastOrder as 
(max(
FILTER(
[Date].[Day of Month].firstSibling:[Date].[Day of Month].currentmember
,[Measures].[Internet Order Count] > 0)
,measures.MonthDate)
-measures.LastOrderDate
)

select 
{
[Measures].[Internet Order Count],measures.DaysToLastOrder
}
on columns,
nonempty (([Date].[Month of Year].[Month of Year],[Date].[Day of Month].[Day of Month]),[Measures].[Internet Order Count])
on rows 
from 
[Adventure Works]
where ([Date].[Calendar Year].&[2012],[Customer].[City].&[London]&[ENG],[Product].[Subcategory].&[1]--,[Date].[Month of Year].&[11]
)

results