Solved

SSAS Calculated Measure Using Link Member

Posted on 2014-10-08
4
181 Views
Last Modified: 2016-02-18
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
Comment
Question by:Daniel Djuracic
  • 3
4 Comments
 
LVL 39

Expert Comment

by:lcohan
ID: 40380224
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
 

Author Comment

by:Daniel Djuracic
ID: 40381269
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
 

Accepted Solution

by:
Daniel Djuracic earned 0 total points
ID: 40412314
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
 

Author Closing Comment

by:Daniel Djuracic
ID: 40419068
Workaround provides required result.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Grid querry results 41 56
SQL 2012 Syntax Error 5 25
SQL 2012 and SQL 2014 always on 9 25
Square brackets 4 0
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now