SSAS-> KPI创建->如何创建一个关键绩效指标来比较某一天与前一天的客户排名?
我一直致力于创建一个关键绩效指标,用于比较特定日期与前一天的客户排名。反过来,您将能够查看该客户的排名是否根据列表生成的内容而上升或下降。在我的情况下,它们是按收入排序的。
我能够通过排名功能轻松地对我的客户进行排名并提供报告,但是当涉及到创建跨天比较这些排名的关键绩效指标时,我正在努力弄清楚应该如何实现这一点。排名本身并不是作为数据存储的,而是我需要通过排名函数动态创建的东西。
这是我的 mdx 查询的一个示例,我用它来创建初始起始报告,该报告为我提供了没有日期拼接的客户排名:
WITH SET [RevRank] AS
ORDER (
[Customer].[Customer Id].CHILDREN ,
[Measures].[Revenue], BDESC)
MEMBER [Measures].[RANKRevenue] AS RANK([Customer].[Customer Id].CurrentMember, [RevRank] )
SELECT NON EMPTY { [Measures].[Revenue], [Measures].[Fact Order Count], [Measures].[RANKRevenue] } ON COLUMNS,
NON EMPTY TopCount( { ([RevRank] ) } , 100, [Measures].[Revenue]) ON ROWS
FROM [DW]
从此我尝试拼接特定日期(日),然后将该排名与kpi 内的前一天。因此,首先我正在努力分解这个查询。我创建了一个预计算集和预计算成员来帮助我更轻松地完成此操作。现在我只是想弄清楚如何在一天内创建这个集合和成员,然后我至少可以在一天和第二天之间进行比较。
2012 年 1 月 26 日更新:好的,我在这方面有点进一步,但我仍然在将排名拉入我的查询中遇到问题,下面的查询的排名为空。希望有人能看到此查询的问题。
WITH MEMBER [Measures].[PrevDayRevenue] AS
( [Measures].[Revenue], ParallelPeriod ([Date Link].[PK Date].[PK Date],1))
SET [RevRankPrevOrder] AS
ORDER (
[Customer].[Customer Id].Members ,
[Measures].[PrevDayRevenue],
BDESC)
MEMBER [Measures].[RANKRevenuePrevOrder] AS RANK([Customer].CurrentMember, [RevRankPrevOrder])
SET [RevRankCurrOrder] AS
ORDER (
[Customer].[Customer Id].Members ,
[Measures].[Revenue],
BDESC)
MEMBER [Measures].[RANKRevenueCurrOrder] AS RANK([Customer].CurrentMember, [RevRankCurrOrder])
SELECT NON EMPTY { [Measures].[Revenue], [Measures].[PrevDayRevenue], [Measures].[RANKRevenuePrevOrder], [Measures].[RANKRevenueCurrOrder] } ON COLUMNS,
NON EMPTY { ( [RevRankCurrOrder] ) } ON ROWS
FROM [DW]
WHERE {[Date Link].[PK Date].&[2012-01-08T00:00:00]}
I have been working on creating a kpi that compares the rank of a customer on a specific date compared to the previous day. In turn you would be able to see if that customer has went up in rank or down in rank in terms of whatever the list was generated by. In my situation they are ordered by revenue.
I am able to rank my customers via the rank function easily enough and provide the report but when it comes to creating the kpi of comparing these ranks across days I am struggling in figuring out how this should be approached. The rank itself is not something stored as data it is something that I will need to create on the fly via the rank function.
Here is an example of my mdx query that I am using to create my initial starting report that provides me with rank of customers without a date splice:
WITH SET [RevRank] AS
ORDER (
[Customer].[Customer Id].CHILDREN ,
[Measures].[Revenue], BDESC)
MEMBER [Measures].[RANKRevenue] AS RANK([Customer].[Customer Id].CurrentMember, [RevRank] )
SELECT NON EMPTY { [Measures].[Revenue], [Measures].[Fact Order Count], [Measures].[RANKRevenue] } ON COLUMNS,
NON EMPTY TopCount( { ([RevRank] ) } , 100, [Measures].[Revenue]) ON ROWS
FROM [DW]
From this I am attempting to splice in a specific date (day) and then compare that rank to a previous day within a kpi. So, starting off I am working on breaking this query up. I created a pre calculated set and pre calculated member to help me do this more easily. Now I am just trying to figure out how to create this set and member by a day and then I can at least produce a comparison between one day and the next.
01/26/2012 Update: Ok, I am a bit further down the road on this, but I am still having issues with getting the rank to pull into my query, the query below has nulls for the rankings. Hopefully someone can see the issue with this query.
WITH MEMBER [Measures].[PrevDayRevenue] AS
( [Measures].[Revenue], ParallelPeriod ([Date Link].[PK Date].[PK Date],1))
SET [RevRankPrevOrder] AS
ORDER (
[Customer].[Customer Id].Members ,
[Measures].[PrevDayRevenue],
BDESC)
MEMBER [Measures].[RANKRevenuePrevOrder] AS RANK([Customer].CurrentMember, [RevRankPrevOrder])
SET [RevRankCurrOrder] AS
ORDER (
[Customer].[Customer Id].Members ,
[Measures].[Revenue],
BDESC)
MEMBER [Measures].[RANKRevenueCurrOrder] AS RANK([Customer].CurrentMember, [RevRankCurrOrder])
SELECT NON EMPTY { [Measures].[Revenue], [Measures].[PrevDayRevenue], [Measures].[RANKRevenuePrevOrder], [Measures].[RANKRevenueCurrOrder] } ON COLUMNS,
NON EMPTY { ( [RevRankCurrOrder] ) } ON ROWS
FROM [DW]
WHERE {[Date Link].[PK Date].&[2012-01-08T00:00:00]}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 ParallelPeriod 函数来计算前一天的排名。这也需要即时完成。
然后你就可以比较两者的 KPI 值......
You can use the ParallelPeriod function to calculate the rank for the prior day. This will also need to be done on the fly.
Then you can just compare the two in your KPI value...
这是我完成的查询,希望这对其他人有帮助。 :
Here is my finished query, hope this helps someone else. :