.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

Calculation of average sales

Posted By:      Posted Date: October 14, 2010    Points: 0   Category :Sql Server

Hi everybody,


I am currently developing reports with Report Builder 2.0 and got stuck with the following:


In order to calculate an average sales amount, I did the following:


Dataset 1:


View Complete Post

More Related Resource Links

Average delay between 2 sales (AdventureWorks)



In the Adventurework FactInterSales table, there's an "orderDateKey" key. 

Imagine that I want to add a new calculated measure, in order to be able to get the average delay (in days) between sales, in general or by customer...

How would you do that ? A new calculated member ? a script command ? Or do I have to do this with SSIS when importing the data ? I hope no...

I've been searching on the net, the DATEDIFF function seams to be the solution, but I couldn't make it work successfully

Thanks a lot for your help


MDX calculation of Daily Sales Outstanding



I have a financial cube and i have to calculate Daily Sales Outstanding as :

Number of Days between the selected month last date and the earliest transaction date when cummulative sum of Revenue from last date of the month till the date where sum revenue <= the debt amount for the date .


On 31/12/2009 my debt amount = 2,500,000

                                               31-Dec-09     30-Nov-09    15-Oct-09     31-Oct-09    

Revenue                                   1,000,000     1,000,000    500,000          1,0000

Cummulative sum of revenue     1,000,000     2,00,000     2,500,000      4,000,000

No of Days                                    31           &n


How to calculate childs age,but when i enter childs age as '03/27/2007' it returns 3 years where as actual age is 2 yr 11 months

calculation, field and map traverse adjustment, and coordinate transformation

Free Pocket PC land surveying software -- COGO calculation, field and map traverse adjustment, and coordinate transformation -- for students and professionals.

Excel Services: Develop A Calculation Engine For Your Apps


The Excel Services architecture lets users design their own algorithms and share workbooks on a server.

Vishwas Lele and Pyush Kumar

MSDN Magazine August 2007

Absence and vacation days webparts calculation



does any1 know if there is a webpart that can calculate an employee's vacation days. and when the employee request some vacation days it show the days that are left.

or is there a tutorial to create such a webpart?


Problem with calculation in combination with crossjoin

Hi fellows   I dont know how to rewrite my MDX in order to get the correct result.    The following MDX statement is reduced to a minimum in order to explain my problem: WITH    MEMBER [Article].[Article].[Article_CE]    AS AGGREGATE ([Article].[Article].[Article_1], [Customer].[Customer].[Unknown], [Location].[Location].[USA])              SELECT       {[Measures].[SalesNet]       ,[Measures].[Budget] } ON COLUMNS ,       NON EMPTY         [Customer].[Customer].[Customer].members         * {[Article].[Article].[Article].members          ,[Article].[Article].[Article_CE]} ON ROWS FROM SALES   If i dont display the customer hierarchie " [Customer].[Customer].[Customer].members " on rows, then every thing works fine! As Soon as I add the above customer hierarchie to my mdx statment, then every thin works fine except for my member " [Article].[Article].[Article_CE]". Instead of showing only one row for customer "Unknown" (see Member definition), a row appears for each customer and with the same SalesNet and Budget.   Any Idea how to rewrite my mdx ?   best regards Pellito

Text Calculation - Removing all text after space

I have a list with workflows that was created for one of our clients that allows them to enter some information and the workflow takes care of sending emails to the necessary recipients as well as notifying the person the task is assigned to when it has reached a certain status or age. The "agent name" colum contains the agent's first and last name (ie John Smith).  I am wondering if there is a way that in the workflow, when an email is generated, if I am able to remove the last name using some sort of text calculation.  The reason I would like to try and do it this way if possible is that if I add the Columns Agent First Name and Agent Last Name, the current Agent Name colum that is being used to generate the agent's name in the email will now not be the correct column to use for this information and the 100s of entries already in the lists will not send out emails properly. Does anyone have a suggestion for this, or know some sort of text calculation formula that I can use to remove the last name from the lookup in the email?

Percentile calculation performance

Hi, With the help of other members in this forum we created a solution to calculate percentile based on a dimension attribute (see Percentile Calculation ). However, performance is quite an issue - it takes about half a minute to calculate percentile on our cube (median calculation takes couple seconds). I do not think that our cube is an issue here because it also takes a while to compute it using Adwenture Works. How to improve the performance of query? Thanks

Enhance SSAS so that a calculation returns multiple cells at once (Excel fill not a single cell but

I wonder if somebody can help me with the following question. I would like to create an enhancement to SSAS in a way so that one can pass in multiple values, run a calculation and in return retrieves not one but multiple cell results at the same time e.g. retSet = functionABC(inSET) where inSet is somthing like 5 4 3 6 7 3 4 4 AND retSet is 4 6 7 8 9 3 4 4 All my calculated members in MDX return a single value BUT I need to have a calculation that if called returns multiple results (a set) at once and in a way so that Excel will properly pick up on it and consequently fills multiple cells in the Pivot table. Is that possible at all and if so how? I would not mind to write a little CLR assembly to enhance the SSAS but don't know how to pass the results back. Any ideas are highly appreciated. Dirk

Performancepoint Scorecard KPI Calculation problem

Hi, i want to calculate the profit in percent from a P/L statement Dimension. i use the following calculation: CREATE MEMBER CURRENTCUBE.[Measures].[CompanyEarnings] AS (     sum( setIncome, [Saldo] )+     sum( setCosts, [Saldo] )   ) / sum( setIncome, [Saldo] ) The Performance-Point Scorecard is Filtered by a Year-Month Hierarchy filter with the following Formular: ([Time].[Year - Month].[Month].&[2010-01-01T00:00:00]):<<UniqueName>> This Formular works fine for the Months, but the sum for the  Year is not calculating on only the selected months, its calculating on the hole year income and costs. If i use a filter on a set with the same months which i hoped was selected with the Scorecard-Filter, it worked fine. Here is the filter which worked, but is not dynamic: SET CURRENTCUBE.[setMonths] AS { [Time].[Month].&[2010-01-01T00:00:00], [Time].[Month].&[2010-02-01T00:00:00], [Time].[Month].&[2010-03-01T00:00:00], [Time].[Month].&[2010-04-01T00:00:00], [Time].[Month].&[2010-05-01T00:00:00], [Time].[Month].&[2010-06-01T00:00:00], [Time].[Month].&[2010-07-01T00:00:00] }; If i change the function that it use this filter all calculations seems to be fine: CREATE MEMBER CURRENTCUBE.[Measures].[CompanyEarnings] AS (     sum( setIncome, [Saldo] )+     sum( setCos

getting minutes from calculation in gridview

Hi..I have to change the background colour of a calculated field (just the cell not the whole row) in my gridview called ElapsedTime, based on the number of minutes e.g > 30 mins background is red.I have already done something simliar for hours..I have succesfully written a sql statement that calculates elapsed timeCONVERT(Varchar, (DATEPART(dd, GETDATE() - DateAdded)-1) * 24 + DATEPART(hh,GETDATE() - DateAdded)) + 'h:' + CONVERT(Varchar, DATEPART(mi, GETDATE() - DateAdded)) + 'm' AS ElapsedTimeElapsed time looks like this e.g 11h:14mI then used this bit of code to get the hourProtected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GridView1.RowDataBound        Dim et As String                ' For Each r As GridViewRow In GridView1.Rows        If e.Row.RowType = DataControlRowType.DataRow Then            et = e.Row.Cells(13).Text            et = et.Substring(0, et.IndexOf("h"))            Dim number As Integer = Int32.Parse(et)            If e.Ro

For loop to find sum and average

I am trying to write a program that will use the for loop to find the sum, and average of 10 numbers a user enters. I was able to do something like this with out a for loop but I want something a bit more efficient . double num1; double num2; double num3; double num4; double num5; double num6; double num7; double num8; double num9; double num10; Console.Write("Please enter a number: "); num1 = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); num2 = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); num3 = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); num4 = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); num5 = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); num6 = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); num7 = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); num8 = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); num9 = Convert.ToDouble(Console.ReadLine()); Conso

SSRS 2008 Sum Calculation in text box

Hi,  Any one pls tell me how to calculate sum of text box values in SSRS 2008. (sum(Fields!Total_Days.Value, "DS_Monthday") - sum(Fields!Weekends.Value,  "DS_Weekends")) - (datediff("d",DATEADD("d",-(DAY(Today())-1),Today()),Today()))   * (Count(Fields!ClientID.Value, "DS_AVGRate")/Count(Fields!DimGPClientID.Value)) +  count(Fields!ClientID.Value, "DS_AVGRate"),Count(Fields!DimGPClientID.Value))   i want to calculate sum of the above expression in text box. I have tried it is showingerror  Aggregate function will not support in text box Pls help me to show the whole sum of above expression in text box only. Thanks in advance. Regards, Abdul2010

wrong Percentage calculation showing in pie chart

Hi,       Im using "#PERCENT{P2}" this one to calculate percentage in pie chart.  It should take 2 decimal only rite? But it is taking 3 decimal values. Example: 20.90678 After applying the formula "#PERCENT{P2}"  it is showing as 20.91 i want to show as 20.90 only pls help me Thanks in advance, Abdul2010

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  

where is Named Query and Calculation member stores?

which place named query and calculation which created in dimension  stores ? and what are the schema is by default when we create cubes?
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