Using a view with ROW_NUMBER (ORDER BY... as a Dimension -
01-20-2006
, 04:01 AM
I need to create a REPORTING HIERARCHY that is multi-level for ad-hoc
reporting purposes through MSRS.
Take for example, an Organization hierarchy in the form of Head
Quarter->Regional HQ->Subsidiary->Stores
Due to the nature of the data, some levels can be NULL (e.g. a Regional
HQ without any subsidiaries and stores yet).
I am using a db view with ROW_Number to implement this Dimension in AS,
such as
CREATE VIEW [dbo].[vw_Entity_Hierarchy_by_Promoter]
AS
SELECT ROW_Number() OVER (ORDER BY vw.Org_Key, vw.Reg_Org_Key,
vw.Sub_Key, vw.Store_Key) AS Entity_Key, *
FROM (
SELECT DISTINCT o.Org_Key, r.Reg_Org_Key, b.Sub_Key, s.Store_Key,
o.Org_Name, etc...
as the ROW_NUMBER may be different each time if a new
store/subsidiary/regional HQ is added, I am worried that this may have
an impact on the Cube, as ROW_NUMBER is what I am using as the
Dimension Key for this. I dont really feel I am doing the things right
here.
Is there a better way to handle this? |