.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

How to Get Total Sales for Customers that ever bought Product X

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

Hi,  does someone know ?
A) How to Get Total Sales for Customer(s) that ever bought Product X     ?  (including/excluding Product X)
B) How to Get Total Sales for Customer(s) that never bought Product X   ?

How to do this in MDX and in Excel Pivot ?



View Complete Post

More Related Resource Links

Find individual customers how have not ordered a product

I need to find any and all customers who have not ordered a product or products. For example, If I have 5 products, I need to know who did not order which products? I have 2 tables: OG table with fields: Line #, Prod Nbr, Desc and Price and Orders table with fields CustName, Cust#, Prod Nbr QtyShipped I am not an SQL expert. Thank you very much for any help you can provide.

Sales Total, Get Curent Month

The date functions in sql is pretty complex to me. I want to get the sum of Grand Total for the current month. OrderDate is a DateTme Column. SELECT SUM(GrandTotal) FROM CompletedOrdersHistory WHERE OrderStatus='COMPLETED' AND OrderDate=@CurrentMonth;

Total Sales and Total Last Year Sales


I have this code below that works fine. But since i have filtered the query to only show 10 specific items. I only get the total yr and ly sales for the specific items. I want to get the Total Sales for all items. Is there a way i can create a set or a measure that would show the Total sales no matter what the item number. Without having to take the filter off the report. Please help!


Also I want to add that I want to display ranking on the sales for the selected items only. So this is why i did the report this way.





MEMBER [Measures].[LY Sales] AS (ParallelPeriod([Time].[Fiscal Period].[Year], 1, [Time].[Fiscal Period].CurrentMember), [Measures].[Vet PL Gross Sales Amt])


NON EMPTY{[Measures].[Vet PL Gross Sales Amt] ,  [Measures].[LY Sales]}


, NON EMPTY { ( (DESCENDANTS([Sell To Customer].[Geography].[RC Division].&[0], 

[Sell To Customer].[Geography].[Customer]) 

* [Sell To Customer].[City].[City].ALLMEMBERS 

* {[Brand].[Brands].[Item].&[230],




Total sales past 12 months



I want to do something as simple as Adding the previous 12 months sales to a row.

My tablix report is suppose to look something like this:

Year Filter: 2010

Months:           Months Sales           Sales Past 12 months
Jan                    12345                        67890
Feb                    23456                        78901
Mar                    34567                        89012
And so on

So ... in the third column, Sales Past 12 months, say for Mar 2010, the Sum should be something like:
Sales Mar 2010 + Sales Feb 2010 + Sales Jan 2010 + ... + Sales Apr 2009 = 89

Show grand total running total in GridView Footer

In many scenarios we need to display Running total as well as Grand total in GridView footer. In this post i will try to explain in an easy way that how we can display running total & Grand total in a GridView footer combindly. To explain this solution using an example here i use a sales order report. The report contains all sales order amount in a tabular way. I will use a GridView to display sales order amount and use GridView footer to display Running total & Grand total. Let we have a customer table with id and name column plus an orders table with OrderID,CustomerID,OrderDate & Amount. Now our goal is to show all customers order with amount as well as page wise running total & grand total. Note that running total is necessary when you enable paging in a GridView where as Grand total is always you can consider.

Default page for my Forlder(product)?


Hai all,

         I need to show the URL like this http://www.saffronrouge.com/face/moisturizers

for me  http://www.mysite.com/products/

i need to list all the products. please help me on this.

UDP Delivers: Take Total Control Of Your Networking With .NET And UDP


UDP, the lesser-known sibling of TCP, is used for DNS resolution, SNMP network status, Kerberos security, digital media streaming, VoIP, and lots more. Learn how to put UDP to work for you.

Yaniv Pessach

MSDN Magazine February 2006

Testing: Get Your Customers Involved in the Testing Process with Functional Tests in Excel


For specification documents to be truly valuable, they need to give an accurate picture of all the requirements of a project. This article describes how the communication value of specification documents can be improved by permitting users to test the code under construction using the Framework for Integrated Test (FIT), an open-source tool. It also explains how you can build a Windows Forms application in C# (WinFITRunnerLite) that converts functional tests, as written by your customers using Excel, into a form that allows you to run them with FIT against the code you're developing.

Will Stott

MSDN Magazine February 2005

Total newbie question: Calling jQuery in an UpdatePanel?



Please forgive this ignorant question - I've used ASP.NET AJAX a good deal but I'm new to jQuery.  Specifically, is it possible to call or create jQuery events on the fly via an UpdatePanel?  For example, calling a jQuery modal or animating a Label (or <div> contained Literal), etc.

If anyone has any advice or could point me to some easy tutorials on mixing ASP.NET AJAX and jQuery, I'd greatly appreciate it. 



Calculating GridView total using JavaScript/JQuery


Hello everyone.

One month ago I've had very nice conversation with a asp.net forum member asking about issue regarding calculation of GridView textboxes total using JavaScript. The main thing was to allow user to manually write values in the text boxes (placed inside GridView column) and if the value has changed automatically to perform calculation on client side.

At the end of the conversation, we came up to two solutions. The first solution was using plain JavaScript, but since I thought it was not so robust, and in order to make it more robust we would need to write few more functions. Therefore, I have simply proposed another solution using JQuery which came up much better, more robust with less code.

In this blog post I will show both of the solutions and will provide step by step explanation on how we did that.

Note: I'm using VWD.

SharePoint Workspace 2010 Product Guide

Get an overview of what's new in SharePoint Workspace 2010 and a deeper look at benefits across all Office 2010 programs, as well as Office Web Apps and Office Mobile 2010.

Programmatic access to Assembly Version in Product Properties?

Using VS2008 and would like to get programmatic access to the Assembly Version property in my Project Properties but I can't seem to find a way to do this. Any suggestions? The project is a .dll and I want to expose this version information to the caller in my interface section as a string.

Get cumulative total value on x-axis.

I'm currently displaying: January $200 February $100 March $400 I want to display:( i've set the custom to MMM on the axis-properties, but still the months are not getting into below required format)  Jan $200 Feb $100 Mar $400 Total $700 on the x-axis.  And i want the y-axis to be divided in the intervals of 200, but though i've set the interval as 200, it is displaying in divisions of 2000.

Calculating Full Year Total

Im creating a sales report in SSRS by pointing it at a cube in SSAS.  Im creating calculated members to aggregate my data in various ways so they can be shown on the report.   I have a FACT table containing sales figures and various dimension tables including a server created time dimension.   Ive managed to create pretty much everthing I need (e.g. Current YTD, Prior year YTD).  What I now need is a full year figure to compare current year sales to.   Below is what Im aiming for i.e. the total of 122712 from 2009 appearing against every month in 2010.   Fiscal Year Fiscal Month Count Full Prior Year sales 2009 Apr-09 9805     May-09 9942     Jun-09 8986     Jul-09 9696     Aug-09 8912     Sep-09 10097     Oct-09 11713     Nov-09 10434     Dec-09 8820     Jan-10 10821     Feb-10 11844     Mar-10 11645     Total 122712   2010 Apr-10 3517 122712   May-10 1669 122712   Jun-10 2518 122712   Jul-10 3306 122712   Ive been bashing my head against a brick wall with this one so any help would be gratefully received!

Looking for TSQL statement that returns customers with greatest number of order in descending order

What would be an efficient TSQL SELECT statement that joins customer and order tables, counts the orders for each customer (group by) and returns a result for all customers with at least one order, and also in descending order from customers with the most orders to the least?

project using ADO.NET & EF works, but not inside customers network...

I'm developing a case management package called SLPortal and I've run into some rather strange problems. Here's the breakdown: It's a .Net 3.5 web app developed in VS2008 using C#, ADO.NET and Entity Framework. Database is MS SQL Server 2005 hosted on Windows Server 2003 Webserver is IIS6 on Windows Server 2003 It's hosted from within the Boise State University LAN. The test system at my house runs 'fine' in that most everything works as intended, aside from the occasional bug from my inexperienced code. Here's the key issue: It seems like when we (myself and the testers) log into the system from on campus, all 'Create' functions quit working, with one exception: I used the Microsoft asp.net MembershipProvider tables to handle the User and Roles functionality. They are built into the FACULTYINTAKE database. All Create, Update, and Delete functionality for these tables work correctly, but note that I am strictly using the MS provided functions to interact with it. I can use the system from home and off the BSU campus and it works. The test systems run Windows XP Pro sp3, Vista Business x86 (32 bit), and Windows Server 2008 64bit using Internet Explorer 7 and 8, Firefox, Safari 4, and Chrome. There are hiccups, but all the database stuff works. When we attempt to use the system from BSU, anywhere on the BSU

create a product webservie for integration

Hi ! I don't know what I am going to do about it. We are selling productcs on our website and one of our partners wants us to give them a xml integration so that they could sell our products on their websites. So what should we do here? where should we start?we use sql server for my data storage. we have created xml files for fundamentals of a sale page for my products we entegrated the xml file to a sales agent website they will use them to view products, their prices.   everything is clear until here. But on the purchase process I need to write the purchase datas into my database table. I have created a dll assembly to write the data to my database but I had to write the connection string of the database inside the dll. So I don't thing it is the best way to do an operation like that.    Experts ! what is the best way to do that? What can I do here? in the real world, what is the comman way of it ? 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