背景:
我有很多问题的分数列表,我已将我的分数分开了 参与者进入代组。
我试图将每个问题的平均分数与该代的平均分进行比较。我当前(失败)的脚本如下所示。
if(Generation = 'Boomers2'
,(Avg(Score)-Avg({<Generation = {"Boomers2"}>} Score))
,if(Generation = 'Generation X'
,(Avg(Score)-Avg({<Generation = {"Generation X"}>} Score))
,(Avg(Score)-Avg({<Generation = {"Millenials"}>} Score))
)
)
我确信我可以使用某个ETL执行此操作 - 理想情况下,我希望使用set analysis
执行此操作,但会接受任一答案。作为参考,这是我的加载脚本。
SurveyRaw:
LOAD
[F1] as RowID,
Timestamp(Timestamp#([A], 'DD/MM/YYYY hh:mm:ss') ) AS [EntryDate],
[B] AS [YearOfBirth],
[C] AS [PerceivedGeneration],
[D] AS [AbilityToAdapt],
[E] AS [TeamWork],
[F] AS [ProblemSolving],
[G] AS [Collaboration],
[H] AS [Entrepreneurial],
[I] AS [Overtime],
[J] AS [Collaboration2],
[M] AS [FutureQuestion]
FROM [lib://workingstyles]
(html, codepage is 1252, embedded labels, table is @1)
where IsNum([B]) and [B]<1998; //and [B]>=1966;
Scores:
CrossTable(Question, Score)
Load RowID, [AbilityToAdapt],[TeamWork],[ProblemSolving],[Collaboration],[Entrepreneurial],[Overtime],[Collaboration2]
Resident SurveyRaw;
Load Question, Avg(Score) as AvgQuestionScore
Resident Scores
Group By Question;
Left Join (SurveyRaw)
Load Sum(Score) as TotalScore
,Sum(Score)/7 as AvgUserScore
,RowID
Resident Scores Group By RowID;
Drop Fields [AbilityToAdapt],[TeamWork],[ProblemSolving],[Collaboration],[Entrepreneurial],[Overtime],[Collaboration2] From [SurveyRaw];
Generations:
Load * Inline
[Year_Start, Year_End, Generation
1946, 1954, Boomers1
1955, 1965, Boomers2
1966, 1976, Generation X
1977, 1994, Millenials
1995, 2012, Z];
IntervalMatch:
IntervalMatch([YearOfBirth])
Load Distinct Year_Start,Year_End
Resident Generations;
答案 0 :(得分:0)
如果您可以为您的Generation分配INT值,您可以执行类似
的操作=Avg(Score)- avg({<Generation ={$(=Generation-1)}>} Score)
答案 1 :(得分:0)
根据计算字段创建2个主维度,一个用集合分析计算每代平均值,一个用于所有选择的总平均值。在加载脚本中执行此操作将使其更快。