.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

How to filter customer count on the previous 3 months

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

Hi, I  want to see  the  total  number  of  new customers  for  the  last  3  months  and also the  total  the  total  number of  existing customers.I have created a meaure called "Customer Count" which  gives me  the  total number of  customers. How will  I use the date range in MDX  to filter these?

I  want to see  this  in MDX for  a  KPI. Can anyone  help  out?




View Complete Post

More Related Resource Links

Measure - New Customer Count

I need to create a measure which counts the number of new customers for each time period. My fact table contains the customer number and its easy to create a distinct count of customers per month/week/year. I'm thinking I need to obtain the first order date for the given customer and compare if the select period is within the time frame, then include or exclude.  

Returning Customer Count of all categories in each time period



Lets say I have the following Table:

CustomerNumber | Date | MovieCategory
1 |2010-01-01|A
1 |2010-02-01|A
1 |2010-03-01|A
1 |2010-04-01|A
1 |2010-05-01|A
1 |2010-06-01|D
1 |2010-07-01|A
2 |2010-01-01|A
2 |2010-02-01|A
2 |2010-03-01|D
2 |2010-04-01|D
2 |2010-05-01|D
2 |2010-06-01|C
2 |2010-07-01|C
3 |2010-01-01|B
3 |2010-02-01|B
3 |2010-03-01|B
3 |2010-04-01|C
3 |2010-05-01|C

What I want to do is count the number of customers for each movie type in each date. Now I started with the following simple query

Select Date, MovieCategory, Count(CustomerNumber)
From AboveTable
Group By Date, MovieCategory
Order by Date, MovieCategory

which would be okay, but if no customer has a MovieCategory of say 'B' on a particular date then the results of the above query won't return a row that has

Date| B| 0     (date here could be any date).


which is really what I need. Is there a good way to

Filter dropdownlist based on previous selection



In my newform.aspx page in Helpdesk template (when I create a new service request), I have added a dropdownlist (lookup type) that list series of issues that user can select.

I would like to add another dropdownlist that further give more options based on the selection made on the first dropdownlist.

How can I drive this second list from the first one? Thanks.


Count the number of months since start date Options

I have a Measure.TransactionValue and also a Date.Month Dim and a 
Subscriber Dim 

I want to do a Count of months since first transaction date by 

Subscriber | Month | Measure.TransactionValue | 
1 | 201002 | 0 | 0 
1 | 201003 | 100 | 1 
1 | 201004 | 200 | 2 
1 | 201005 | 300 | 3 
1 | 201006 | 0 | 4 
1 | 201007 | 50 5

Make sense?

Any help would be greatly appreciated. 

MDX Count Filter Question


I have sales reps that have a series of metrics (calculated members) assigned to them.  If their sales are over a certain amount I need to count them as one group, and if the sales are under that amount, I need to count them in a different group.

However, I then need to count the number of reps that fall within arbitrary ranges (buckets) also.  I thought about the descritize method but I need to be able to tightly control the dollar ranges of the buckets.

Any help is appreciated.

BCS Lookup - Filter Customer Address lookuup By Customer


I currently have a custom list with a "Customer" and "Customer Address" BCS Content Types . I would like the "Customer Address" content type lookup to be filtered by the customer I have selected in the customer content type. 

Is this possible with an external content type created in SharePoint Designer, or is this only possible using Visual Studio? Or is this even posisble at all?



Using jQuery to Filter Table Rows

The project is using the .net GridView control, so I had limited control over the output HTML code. Still, I think this code can work for most tables. One thing to notice: you should use the class "filterable" on your table or on one of its parents for the code to work.
First, we need a text box:

GridView Multiple Filter AJAX Control

This AJAX control enables the user to filter data within any column inside a GridView. The user can add multiple filters and can delete existing ones too.


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

Retrieving a variable from a previous page



I'm looking to have a search page where a user will select an item from a listview, then then taken to another page that wil display data based on their original selection.

A user will type in a string and be presented with a list of usernames that are like that string, when they select a user name who's profile they would like to view I would like the page that they're taken to, to be that users profile.

How would I transfer the variable from the search page to the profile page, and when I work on the profile page, how can I access that variable?


Where to Filter the companies returned by the EF?



I am just starting with dynamic data. I have an enttity framework called UsersModel.edmx.

It returns a list of all companies in the tblCompany table. This list is really big.

I need to filter the list returned to all user controls on the client so that it only returns the company that have a CompanyTypeId= 2 or CompanyTypeId= 3 and company name != "".

1 - Is it possible to filter the company list returned on the server so that I can filter only once for all the controls that use that on the client?

My ideas was to do something like this using linq and lambda but I am not sure how:

return tblCompanys.Where(c => c.CompanyTypeId == 2 || c.CompanyTypeId == 3 && ).Where(c=>c.CompanyName != "").OrderBy(c => c.CompanyName).Distinct().OrderBy(c=>c.CompanyName);

2 - I have created a partial class and a metadata class and added the DisplayColumn attribute to use the company name and sort by company name ascending.

Could I use the code to filter the returned companies in this? where?

namespace MarsMedicalModel
    [DisplayColumn("CompanyName", "CompanyName")]
    public partial class t

Filter by Computed Column



After looking for a driver to open legacy dbf drivers to connect, the next level trouble a have is this one:

first, i can retrieve the data but when trying to filter by a parameter (somesc columns) i get an error.

The error says about the database can't determine some blah blah!

The error is a columm tha is formated (  1234  ) about  8 space, fixed. The values in the query appears like that. I resolve this by Trimming Ltrim(ColumnName) and i get this (1234).

Now in SqlExpress, how can i filter by the new Trimmed Expression? (This is a primary key that the DBF use)


SELECT column1, column2, column3


SELECT Ltrim(column1) as NewExp, column2, column3
Where NewExpre = @NewExpres                  -Error-


Print row count on Label



I have an SP that simply performs a COUNT(*) from a table. I'm am trying to print that number in an ASP Label. It works in Query analyzer but I cant wrap my head around how to display it in a label. Any guidance much appreciated. 

Thank you. 

LDAP nested groups filter


Hi all,

In my organization we use nested groups.

For a particular usage, we have a group (let's assume that the group name "kuku"), and the names of all the nested groups under it contains "kuku" as well.

We may assume that no other group in the LDAP has "kuku" in the name.

I need to create a filter which will return all the users which belong to one of the "kuku"s group.

Obviously, using this filter will bring only the head kukus

(&(&(objectclass=user)(objectclass=person))(memberOf=CN=kuku,cn=.rest of the group DN.))

How can I use wild card to fetch all users which belong to any kuku?

For example: (&(&(objectclass=user)(objectclass=person))(memberOf=CN=.*kuku.*))



Count words in the ascx file



I have 163 .resx files. I want to count the words in these files, because my want to translate the sentences (my task is the localisation).

Now I'm opening each file in Ms Visual Studio and I count words manually. How can I count words in all files? And the second question: can I use a program what grab strings from .resx into an editor where I can translate them and save bacn into .resx files? Or must open the files one by one and edit the text fields manually?

Thanks for helping, unfortunately I'm not a programmer.

Urgently Need Help : Unrecognized Tag Prefix or device filter 'CR'


I have download and installed the Crystal Report for 2010 from my Visual Studio 2010. 


Problem 1 :

When I create a new crystal report in the Project, the aspx created code below :

<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
            AutoDataBind="True" GroupTreeImagesFolderUrl="" Height="1202px"
            ReportSourceID="MemberList" ToolbarImagesFolderUrl="" ToolPanelWidth="200px"
            Width="1104px" />
        <CR:CrystalReportSource ID="MemberList" runat="server">
            <report filename="MemberList.rpt">

 but there is error : unrecognized tag prefix or device filter 'CR'


Problem 2 :

The vb code of the crystal report that I had created has 'ComponentModel is not a member of 'MYPROJECT.system'



How to display a count of search results with keywords in a label?


Sorry for a basic post here; I am very new to VB!

I am currently building a search page, which includes a textbox and two drop-down lists, a search button, and a datagrid. If results are found and displayed, I would like a label to display:

(e.g.) "24 results found for 'blue sky clouds' "

...where the integer represents the results count, and the keywords and/or drop-down list selections are included in the string.

If no results are found I would like the label to display:

(e.g.) "No results were found that match your selection. Please try again"

I would also like the label to be invisible until a search occurs.

Thanks in advance!

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