Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

SSAS Calculated Measure Using Link Member

Hello,

I have been trying to get a calculated measure working in SSAS to show the number of open records against a date dimension.

My fact table contains "Created Date" and "Resolved Date". Measure i am using is simply "Record Count".

I have 3 Date Dimensions "Created Date", "Resolved Date" and another with no relationships called "Open Date".

I have been able to get a Calculated Measure working using the following:

CREATE MEMBER CURRENTCUBE.[Measures].[Open Records]
 AS AGGREGATE(
    {NULL:LINKMEMBER([Open Date].[Year - Month - Date].CurrentMember
        ,[Created Date].[Year - Month - Date])}
    * {LINKMEMBER([Open Date].[Year - Month - Date].CurrentMember
        ,[Resolved Date].[Year - Month - Date]):NULL}
    ,[Measures].[Record Count])

When I utilise this measure in Excel i can open up year and month, but when I open date, it takes an exceptionally long time to run, however it does eventually complete (I estimate it takes at least 30mins).

Am i doing something obviously wrong or is there a better method I could be using to get the result I am after?

I am using SQL2014.

Thanks,
Daniel
0
Daniel Djuracic
Asked:
Daniel Djuracic
  • 3
1 Solution
 
lcohanDatabase AnalystCommented:
I believe that is because when you try to open it in Excel by the day it will have to count with a "GROUP BY" at that date part level and proper data type/indexes could help in this case.  Can you please check to see the underlying data type for the three date columns and to see if there are any indexes on them?
0
 
Daniel DjuracicAuthor Commented:
Thanks for the reply, the date dimension table had a Clustered Index on the Primary Key (which is a datetime) data type. I have added a non-clustered index to the "CreatedDateKey" and "ResolvedDateKey" fields with no effect.
0
 
Daniel DjuracicAuthor Commented:
I worked around the issue by creating a whole new cube based on a view. The view unions 2 versions of the fact table, 1 uses created date as "Open Date" and the other uses resolved date as "Open Date" it then has another field which is 1 when open and -1 when closed, summing this measure produces the required results.

SELECT        CreatedDateKey AS OpenDateKey, 1 AS OpenCount
FROM            [DataWarehouse].[dbo].[FactITSMRecords]
UNION ALL
SELECT        ResolvedDateKey AS OpenDateKey, - 1 AS OpenCount
FROM            [DataWarehouse].[dbo].[FactITSMRecords]

Open in new window

0
 
Daniel DjuracicAuthor Commented:
Workaround provides required result.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now