我试图根据我们今年忙碌的学生注册的学生人数来预测我的组织需要预订的房间数量。
这个问题的第一部分是计算今年与去年相比学生数量的相对减少/增加,并使用它来推断今年的学生数量。
为此,我正在尝试衡量以下内容:
我有以下查询:
@ViewChild('divBody', {read: ViewContainerRef}) private body: ViewContainerRef;
this.body.clear();
let factory = this.resolver.resolveComponentFactory(Artists);
let injector = ReflectiveInjector.fromResolvedProviders([], this.body.parentInjector);
let b= this.body.createComponent(factory,0,injector,[]);
// data is comming from an ajax call to a remote location.
b.instance.artists = data.artists.items;
b.changeDetectorRef.detectChanges();
但是,当我将WITH MEMBER [Measures].[Period Growth] AS
(
[Measures].[Enrolments By Week],
ParallelPeriod([Weekly Enrolments Date].[ISO Week Calendar].[ISO Year],
1,
[Weekly Enrolments Date].[ISO Week Calendar].[ISO Week].currentmember)
)
SELECT NON EMPTY { [Measures].[Enrolments By Week], [Measures].[Period Growth] } ON COLUMNS,
NON EMPTY { FILTER([Weekly Enrolments Date].[ISO Week Calendar].[ISO Week].&[201738] :
[Weekly Enrolments Date].[ISO Week Calendar].[ISO Week].&[201752],
Cint([Term Record Creation].[ISO Week Number Of Year].CurrentMember.Member_Key) <= 10 --Cint( STRTOMEMBER(@ToISOWeekNumberOfYear, CONSTRAINED).Member_Key )
OR
Cint([Term Record Creation].[ISO Year].CurrentMember.Member_key) <
Cint([Term Start Date].[ISO Year].CurrentMember.Member_key)) } ON ROWS
FROM [Enrolments]
中的成员表达式设置为#Error
时,我得到ParallelPeriod
计算成员。如果我将CurrentMember
更改为CurrentMember
之类的值,则错误消失 - 为什么会这样?如何比较上一年的同一周作为当年每周行的比较?
此外,如何在同一周内获得每周相对于上一年的百分比变化,同时避免除以0错误?
答案 0 :(得分:1)
对我而言,这看起来像一个级别:
[Weekly Enrolments Date].[ISO Week Calendar].[ISO Week]
所以是的,这是有效的,不会有错误:
[Weekly Enrolments Date].[ISO Week Calendar].[ISO Week].&[201642]
但我不认为CURRENTMEMBER
函数可以应用于关卡表达式 - 如果你只是缩短到以下它可能会更快乐:
[Weekly Enrolments Date].[ISO Week Calendar].currentmember