.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

MDX to calculate balances recursively.

Posted By:      Posted Date: September 22, 2010    Points: 0   Category :Sql Server

Hi All,

I need some advise from you guys....

I have a scenario as follow:

I want to measure a time taken to finish one process. A process consist of several steps and a step consist of several tasks.
I want to see how long does it take from one task to another task, as well as step to another step.
I want to be able to see what's the opening balance (in minutes), WIP balance (in minutes) and closing balance (in minutes) of each level.

I have a calculated measure to calculate opening balance, WIP balance and closing balance at any point in time.

I also have the following condition for calculating opening balance:
If the date (can be any date) is not the first sibling of any date level (first day of the month, first month of the quarter, first quarter of half year, first half year of the year) then use previous member balance
else use the balance of first sibling.

For example:
If today is 5 September 2010, then I should use balance of 4 September (day level), which is a calculated measure itself
If today is 1 September 2010, then I should  use balance from September (month level), again this is the calculated measure itself.

I am nearly sure if I had taken the wrong because the performance is really bad, especially when I drill down into Day level.

What's the

View Complete Post

More Related Resource Links

Calculate distance, bearing and more between Latitude/Longitude points

This page presents a variety of calculations for latitude/longitude points, with the formulæ and code fragments for implementing them.

All these formulæ are for calculations on the basis of a spherical earth (ignoring ellipsoidal effects) - which is accurate enough* for most purposes. [In fact, the earth is very slightly ellipsoidal; using a spherical model gives errors typically up to 0.3% - see notes for further details].

How to calculate the distance between two points on the Earth

We offer many Global Database Products that you can use with the below formulas to calculate distances and many other uses. Not sure how to use distance calculations or global databases within your company? See our Global Database Examples for more information on how to use our data within your industry. Be sure to Download a Free Sample of one of our many Global Database Products.

Logic to calculate business hours


Hi All,

I have tried searching all over the web for this logic. Got many but half of them did not match what i was looking for and half were malfunctioning.

I want to calculate business working hours between 2 datetime, where in I should be able to set the working hours as well as weekends and holidays should not be calculated.


Please help me guys... It will be a great help... 

Calculate Client Height in javascript

The article Calculate Client Height in javascript was added by amoljk2009 on Monday, May 31, 2010.

Hi, Following code will help the developer to calculate exact client height in all browsers.script language="javascript" type="text/javascript">var winW = 630, winH = 460;if (parseInt(navigator.appVersion)>3) {if (navigator.appName

calculate fields in a list



how do I go about generating formulas for something like this.

I have a field( choice ) that has three choices (Low, Medium and High ). If I choose Low, I need to add 5 days to the current date( excluding weekends ) and place it in the Target date field, the same goes for Medium = 3 days( exclude weekends) , High = 1 day, exclude weekends.



KPI to calculate list item clicked most ?


Hello All:

Is there anyway where we can use KPI list to attach to a SharePoint list and indicates which item was clicked the most ? Or any other way to find out the best 5 links based on how many times they were accessed by a user?


Thanks in advance

SharePoint Developer

Performance Problems with calculate member in a cube

Hi,  I'm having performance issue with calculated member (Running total) which is created on one dimension in the cube.  Cube is having three dimension Product Details(Product Model, Product Type) , Time(Year & Month) & Qty type(In Qty & Out qty). See below for details Dimtime Year (Values 2000 to 2020) Month DimProd Product No Product Type Product Group DimQty Type In Qty Out Qty Fact Table Product No Year Month Qty Type of Qty( In Qty or Out Qty ) My MDX query for calculated member is  CREATE MEMBER [Qty Type].[Qty Type].[All].[Total] as      SUM(NULL:[TimeDim].[Hierarchy].CurrentMember , ([Qty Type].[Qty Type].[In Qty], Measures.[Qty]) - ([Qty Type].[Qty Type].[Out Qty], Measures.[Qty])  The formula is --> Total = Previous Period Total Qty + Inqty - Out Qty   This works perfectly when i browse at higher level (Qty Type on Rows & Time On Columns),   but when  i browse the cube adding dimension Product Details( Product group or Product Type) to Drill-through the In Qty & Out Qty,  the query is running and after one hour also it's not finished. Can anyone help me to solve this or propose new structure to resolve this issue.   

how i can calculate date difference in oracle

how i can calculate the date diff in Oracle 10g using pl sql developer 7thank you

Two many to many dimension => How to calculate correct facts????

Hey guys,   I got a problem and I hope someone could help me with it.  I have the following scenario which I need to solve. The Schema looks something lilke that...   DIM3 DIM3_Key Dim3_Att   FactlessFact_DIM3_DIM4 DIM3_Key DIM4_Key WeightingFactor   DIM4 DIM4_Key Dim4_Att     FACT DIM1_Key DIM3_Key Sales_Fact   DIM1 DIM1_Key Dim1_Att   FactlessFact_DIM1_DIM2 DIM1_Key DIM2_Key WeightingFactor     DIM2 DIM2_Key Dim2_Att   As you can see my Facttable is connected to two dimension which are actually many to many. Also there is a 'WeightingFactor' in every FactlessFact table (BRIDGE), so that i am able to correct (as defined by the factors) values when ever I query DIM2_Att or DIM4_ATT.   So the Problem I have is that I every Fact shoud be MULTIPLIED with the WEIGHTING FACTOR. Well in MSAS 2008 I can do that with an Measured expression but since a measure needs to be unique I cannot just use 'WeightingFactor'. So When I renamed it to WeightingFactor34 and WeightingFactor12. But this only gives me the correct values for the defined Path. In case I use  WeightingFactor12 i only get the correct values for DIM2_ATT but not for DIM4_ATT.   I guess I need to solve this with a calculated Measure???? Am I right? I am new to MSAS and also new with MDX and all this stuff... How can use a calculated meas

MDX Calculation to calculate Rank

Hi all, I am trying to calculate rank of the objects based on sales. It should only change for date dimension. For all other dimension attributes, it should remain the same. Please help me out. Thanks, Sam  

Calculate variance based on property of account

Hi all, I'm having a problem implementing a requirement in SSAS. The case: There is a parent-child dimension Account which contains different accounts on which figures can be booked. This dimension has a unary operator. In this example I have three accounts: "Net interest income" and "Global operation allocations". These two accounts have the same parent "Net result". Besides the account dimension there is a scenario dimension which contains three scenarios: Actual, Budget and Variance. On every account can be indicated whether it is a "Expense Reporting" account. If this is the case the Variance is calculated by "Budget - Actual", otherwise this is calculated by "Actual - Budget". I implemented this by the following calculation script in the cube: -- Calculate Variance scenario SCOPE ([Scenario].[Scenario].[Variance]); SCOPE ([Account].[Expense Reporting].&[True]); THIS = [Scenario].[Scenario].[Budget] - [Scenario].[Scenario].[Actual]; END SCOPE; SCOPE ([Account].[Expense Reporting].&[False]); THIS = [Scenario].[Scenario].[Actual] - [Scenario].[Scenario].[Budget]; END SCOPE; END SCOPE; So far, so good: the variance is calculated correctly for the accounts on which the data is loaded: "Net interest income" and "Global operation allocations". However, on the account

calculate business day between two dates

Hi Guys   I need the count of business days between two  dates Date1, Date2 i need the count only business day (exclude sartuday&sunday) If date1 is null or nothing i need to pass 0 If date2 is null or nothing i need to pass 0   help on this

Using datediff to calculate elapsed time

Hi..my app requires an elapsed time calculation that I have done like thisCONVERT(Varchar, (DATEPART(dd, GETDATE() - DateAdded)-1) * 24 + DATEPART(hh,GETDATE() - DateAdded)) + 'h:' + CONVERT(Varchar, DATEPART(mi, GETDATE() - DateAdded)) + 'm' AS ElapsedTimeThis works.. I can then colour my grid view cells  accordingly using the substring function.. the problem is that I have been told that using GETDATE three times is not a good use of resources, is it possible to use the Datediff function to get the same result?thanksDan

How do you calculate a value in one list from the conditional adding of values in another list ?

I have a list (call it my first list) with a attribute of Initial Estimate (Hours) and a unique ID and want to conditionally search for that unique ID on another list (second list) and aggregate the Initial Estimate (Hours) on the second list to arrive at single value for my first list! Any ideas on how to do this?

Calculate Future Age and Date

I hope someone can help me. I am new to SharePoint and I was given the task to determine all the people who will be age 65 in 90 days from today (meaning current date), and display them in a list. I haven't a clue how to do that. By the way, we are still using version 2003. I would very much appreciate the help. Thanks! Kelly  

MOSS 2007 Calculate Due Date including working hours and working days

Hi, I've searched many forums for an answer to my problem but with very limited success. Basically, I've created a Sharepoint list where I would like to track a resolution of incidents versus SLA timings. I have a column with a receiving date, which is a date when the request was submitted and another column with priority code where I have 3 possible values: low (5 working days to close the request), medium (3 days) and high (1 day). What I would like to do is to automatically calculate due date for solving the incident based on the receiving date and the priority code. The thing is that now it is getting more complicated since I need to exclude saturdays and sundays from calculation, as well as national holidays. Then I would like to take into account working hours (from 8am to 4pm), for example if an incident with medium priority was submitted on Friday 5pm, then it would have its due date set to Wednesday 4pm (the request was sent after working hours so we have 3 full working days to complete it) Not sure if it is feasible to achieve using formulas, maybe some other way?

How to calculate a SQL Server performance of a query based upon table schema, table size, and availa

Hi What is the best way to calculate (without actual access to a SQL Server) the processing speed of a query (self-inner-join) based upon table schema, table size, and hardware (CPU, RAM, Drives)? ThanksThanks Jeff in Seattle
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend