Solved

SSAS Calculated Measure Using Link Member

Posted on 2014-10-08
4
184 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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Query 3 49
Can Unique column have more than one Null? 8 46
How to get sum of group by column and sum of total values 4 56
TSQL DateADD update Question 4 29
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 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

16 Experts available now in Live!

Get 1:1 Help Now