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

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

Help with Percentage Counts for Prior 3 months

Posted By:      Posted Date: September 19, 2010    Points: 0   Category :Sql Server
I am trying to calculate the counts of issues for the prior 3 months as a percent of the total of all issues for the prior 3 months. eg. For Sept. I would need the counts for Jun, Jul, Aug for each issue type divided by the total number for all issue types for those 3 months..

For the numerator I used the following and have confirmed that it is correct via SQL queries. 

CREATE MEMBER CURRENTCUBE.[Measures].[PctUniqueIssuesNumerator] AS Aggregate
( {[IssueDate].[ProgMonth].CurrentMember.Lag(3) : [IssueDate].[ProgMonth].CurrentMember.Lag(1)}
    [InvoiceIssueType].[Invoice Issue Type].CurrentMember
    [Measures].[Invc Id Distinct Count - IssueFact]

For the denominator I am using this MDX but doesnt seem to be correct. Should I be doing it differently? I need the sum of [Invc Id Distinct Count - IssueFact] for all issues types for the prior 3 months.

CREATE MEMBER CURRENTCUBE.[Measures].[PctUniqueIssuesDenominator] AS Sum(
    DESCENDANTS([InvoiceIssueType].[Invoice Issue Type].[All],1),

More Related Resource Links


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

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is no



 I keep getting the following error. I also added time out parameter in the connection stirng and it still did not help. Has any one faced similar issues.

Thanks in adavance.

Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.


Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.]

Display name of months on x-axis in a chart

Could you please let me know if there is any expression which can be used to display the months on x-axis of the column chart. I've tried playing with the Axis option trying to change the interval type to "months" but it is not giving the result. Thank you.

Reports in Percentage

Hi ALL, I have scheduled hours of each employee for each week and no of days scheduled in a week.i want to get reports for weekly wise no of employees scheduled less 24 hrs per week,b/w 24 and 48 hrs and greater than 48 hrs       Scheduled Hrs              8/1/2010         8/8/2010        15/8/2010            22/8/2010 Less than 24 hrs               5%                      5%                       5%                          4%   b/w 24 and 48 hrs          4%                        6%                    &

Calculating percentage of sceduled hours

 Hi all,       I want to calcultae how many employees are scheduled less 24 hrs for each week,b/w 24 and 48 and greater than 48         In excel file i have weekly wise total hours scheduled for each employee  and total no of days scheduled in week(example 6 days and 1 off)which i will upload it to database,based on this i want to display reports  in bound controls Result should be like this                    Scheduled Hrs      8/1/2010        8/8/2010       8/15/2010       8/22/2010                  Less than 24 hrs     5%                       5%                  5%                   5%        Between 24 and 48 hrs    5%         

Timeout error - The timeout period elapsed prior to completion

Hi, I'm using ASP.NET 3.5 (c#) with SQL Server 2008 server. Recently, I started getting error "Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.". After looking at forums for solutions, I added the below common code to my application. protected DbCommand CreateCommand() { SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandTimeout = 600; // 10 minutes return sqlCommand; } However, intermittently, I'm still getting the timeout error. I added the logging to see where error is occuring. And found that before executing one of the query, it is giving this error. Now, my assumption is that I should have received this error after runnign query for 600 seconds (10 minutes) since I set it in the above function. But the timeout error is occuring instantaneously within 1 second itself. In the log, I printed one line above & after the query to identify how much time it would take. Surprisingly, the log says that 9:00 AM "Before query execution" & at 9:01 AM "timeout expired...." I would really appreciate if some one can help me out here! Thanks!

SQL Reporting Services - Page X of XX counts in header

I have searched high and low for how to calculate page numbering in the header where the global values do not apply.   I have a report that generates 300+ invoices and I need the page numbers to reflect page x of xx for that invoice only.  My report page breaks for each customer invoice.  I have found code to get the page number in the header and I have found code to get the total pages in the body.  These two solutions cannot be combined.    Has anyone found a workaround in code behind or some other method?I would appreciate any guidance.   Side note: thank you all for all your postings and solutions.  They have been highly valuable as I am new to SSRS.

Getting tags and their counts for a given URL Base?

I'm fighting with the SocialTagManager since a few hours to get something incredibly simple done: For a given URL Base, give me all tags (from the Tags and Notes) and how often they are used, if the tags start with a certain string. So I have a Page http://myportal/SomePage.aspx that is called with an ID, like  http://myportal/SomePage.aspx?ID=1 http://myportal/SomePage.aspx?ID=2 etc. Each ID-Page can be tagged by users.   In SQL, this is trivial:   SELECT TOP 10 InputTermLabel, COUNT(InputTermLabel) AS Count FROM dbo.SocialTags WHERE InputTermLabel LIKE 'su%' AND UrlID IN ( SELECT UrlID FROM dbo.Urls WHERE Url like 'http://myportal/SomePage.aspx%') GROUP BY InputTermLabel ORDER BY Count DESC   I can't find a proper way to do this through the Object Model. My current approach is this:   public IDictionary<string, int> GetTags(string query) { var result = new Dictionary<string, int>(); using (var site = new SPSite(_siteId, SPUserToken.SystemAccount)) { var baseUrl = Config.GetSocialUrlBase(site.RootWeb); var stm = new SocialTagManager(SPServiceContext.GetContext(site)); var terms = stm.GetAllTerms(new Uri(baseUrl),0); foreach (var term in terms) { if (!term.Term.Name.StartsWith(query, StringComparison.InvariantCultureIgnoreCase)) continue; var tc = stm.GetUrls(term.Term); int usageCoun

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

PerformancePoint filters arranging months out of order

I have a pretty simple analytic chart on my sharepoint site. The columns are The name of the location, and the month, and then all of the data is in the rows.   so basically it looks like this                   Place 1                                  Place 2           jan feb mar april may june             jan feb mar april may june row1 row2 row3   You get the point. The problem is, I want to have two filters; one that filters by the locations, and one that filters by the months. When I created the locations filter and connected it to the grid, it made all of the months go in alphabetical order instead of the correct order, like so:                 place 1          aug dec jul nov oct row1 row2 Obviously, this is not how a calendar is supposed to look. I already changed the properties in my sql cube to make the months go in the correct order in the unfiltered chart. They are ordered by the key, which is mont

A tsql report with multiple counts and pivioted description attributes

Hello,   I have an assignment in which I am to prepare a report displayed in excel to return counts of various attributes in the database. However, the count is a bit challenging because it requires counting certain attributes in a pivot format illustrated below. The counts for each category by recruiter, rolled up by Division, within the specified time frame.   The tables that I would have to deal with are as follows:   User: Has the number of Accounts…user accounts with no Recruiter are unassigned Recruiter: Has the recruiter information LoginHistory: Has a record of all logins EForm: Has the various forms, for example: Release and Authorization, Provider Service Agreement EFormUserXref: You can filter it to return the Physican AppForms                                                                       Surgery                                      &n

Percentage of matching days off among employee's

Hi All,i have Intime and Outtime of each employee for all the days of 1st,2,3,4 week.There will be a off for 1 day or 2 days for each employees.Based on this i need to calculate consisitency days off assignmanet i.e no of matching days off among employees in percentage.If there are 100 emplyees out of 100 employees 50 people may get week off on the same day(for example sunday). I want result in percentage.result like thisConsistency Days of assignment            Across 4 weeks            3 weeks                2weeks                0                                                             2%                                   0%     &

Algorithm for Computing Age in Years, Months and Days?

I am generating a crystal report.net that compute age of a person through formula. of course, there is the birthdate and current date. I am familiar with the datediff function but I want to compute is like: "18 Years, 2 Months and fifteen days old." it should include the leap year. Any Algorithm that I can apply to crystal report formula? Your help is very appreciated.

Pie show percentage greater than 100%

Hi all , i have a pie chart and show percentage as label ,i set label data as #PERCENT{P0} but when report runs it has 3 value: 58%,11%,32% you can see the 3 value add up to 101% is something else i need to set on label ? any help for this ?

Getting counts by 2nd Date Dimension Attribute with Snapshot Style Fact Table

  I have an MDX question finding hard to solve.  I have a Snapshot Fact Table with a snapshot of the records in the source system for each batch date.  All records in the fact table are assigned the batch date with the batch date key.  There are many records for each day and each batch date is an entire copy of the source records.  So, the grain of the fact table is one record for each batch date that exists in the source system.  These facts rows have another date in them for when the record was entered.  This date is different from the batch date in that the batch date is based on the day the batch was processed and the entered date is based on when the record was entered.  If a record was entered many days before, its batch date will be today but its entered date will be several days ago.  Therefore each day a copy of all the records entered the previous batch date and all the records added on today's batch date are present. Fact Table : FactSnaphshotKey (surrogate for easier administration) BatchDateKey (link to batch date dimension – date dimension, first in dimension list so it is used for semi aggregate measures) EnteredDateKey (link to entered date dimension – date dimension) Facts Count – measure for fact table - default measure from Analysis Services cube 2 Dim

Getting MAX Per Day for Months

I have a table containing measurements taken every 5 minutes for a span of 8 months.  What I would like to do, is take the max measurement per day and return it.  Right now I'm using the following query which does the trick, but would involve a LOT of typing if I tried to return all the data I need: SELECT Date, MAX(Temperature) AS Temp FROM tblTemp WHERE Date IN ('3/5/2010', '3/6/2010') GROUP BY Date This returns the max temperature for 3/5/2010 and 3/6/2010 fine...  but you can see how this would be cumbersome doing it all the way through August :-)

do i need to install .NET Framework 2.0 prior to .NET Framework 3.5?

hello, i need to install on my computer .NET Framework 2.0 and .NET Framework 3.5. .NET Framework 3.5 installs .NET Framework 2.0 SP2. I've searched the web for an answer but i find different opinions. is it ok, to install the 3.5 only (for .net 2.0 applications!!!)? In Windows XP, you have sp3 as an exe file which only upgrades an existing operating system. maybe this is the case with the 2.0 sp2 within the 3.5 installation? everything points to the conclusion that it is ok to install only the 3.5, but the opinions that say otherwise, are making me second guess my instinct. i want to know if it is sufficient to install the 2.0 SP2 (that's in the 3.5 installation) or do i need to install the 2.0 prior to  the sp2. should i write a script like this: start /w dotnet2.0Installation.exe ... start /w dotnet3.5Installation.exe ... or like this: start /w dotnet3.5Installation.exe ...   thank you in advance Udi
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