Reg: Total sales of each month of customer
Dear All,
I have the below two tables
Customers (customer_id, custer_name,customer_address)
Sales (sales_id, sales_cust_id, sales_order_date, sales_amount)
I need to write the SQL query to display the total sales made by each customer, each month with grand total of all months of current year
can anyone help regarding this..
Sample
customer_id
customer_name
month
total_sales
12
aaa
Jan
15242
12
aaa
Feb
17889
(Total)
33131
13
bbb
Feb
1487
13
bbb
Jun
19987
(Total)
21474
Hi,
You can use GROUP BY GROUPING SETS to get sub-totals in SQL:
SELECT sales_cust
, NVL ( TO_CHAR ( TRUNC (sales_order_date, 'MONTH')
, 'Month YYYY'
, ' All months'
) AS month
, SUM (sales_amount) AS total_sales
FROM t
GROUP BY GROUPING SETS ( (sales_cust, TRUNC (sales_order_date, 'MONTH'))
, (sales_cust)
ORDER BY sales_cust
, TRUNC (sales_order_date, 'MONTH')
Output from the sample data Ramin posted:
SALES_CUST MONTH TOTAL_SALES
12 May 2013 120
12 June 2013 15
12 July 2013 110
12 September 2013 750
12 All months 995
13 May 2013 70
13 July 2013 205
13 All months 275
Similar Messages
-
Reporting of total sales after 12 months
Am I correct in thinking that after an app has been in the store for more than 12 months the total sales reported are not the actual total of all sales. If it is correct that only sales up to 12 months are reported is there any way one can get a complete
total?
Thank you
Malcolm Bain
Malcolm BainHello Malcnoo,
Currently the financial summary is limited to the last 12 months with no way to pull records beyond that.
-Miles
Windows and Windows Phone Dev Center Support
Send us your feedback about the Windows Platform -
Help in finding the total count for each month
Hello everyone,
Sometime back I had posted about the date function. I have that problem solved now my problem is that after finding all records which against each record I need to find the total count for that month if no records than I have to set it to a 0.
Here is how my program has been written.
PROCEDURE extract_materials
IS
CURSOR xyz
BEGIN
FOR xyz1 IN xyz LOOP
-- once inside the loop for each of the record from
the cursor I need to find a total count for that record for everymonth in the year.
All these records will be instered in to a staging table
Can you please help me out with this. I really appreciate this.
Thanks in advance.
-VaniAndrew - you missed the tricky bit of the spec - include missing months with a zero.
You need to do an outer join to a select from any big table with a function involving rownum and add_months to generate all the possible months. However, its time to go home and I can't be bothered to work out the finer details. -
Creating a cumulative total by day measure which resets each month.
Hi,
I need to creative a cumulative total measure (or calculated column) which accumulates my revenue sales for each day in a month, but resets each month.
I've created an example below:
The dates are from a linked date table and are based on a fiscal year. When the months are collapsed the months can either accumulate or stay fixed to the max for the month, that does not affect me.
I have tried various attempts using the guides below and I'm sure the answer is there but I can't get the filtering right.
I can get it to work but accumulate since the start of my data but this is not what I need.
http://www.daxpatterns.com/cumulative-total/
http://javierguillen.wordpress.com/2012/11/28/running-total-techniques-in-dax/
Thanks.It appears that your months align with the standard calendar's months. I.e. your fiscal calendar's October always aligns with regular October. If this is the case, then you can simply use the built-in time intelligence function TOTALMTD().
MTD Measure:=
TOTALMTD(
[Measure]
, DimDate[Date Field]
If this is not the case and your month does not always line up with the standard calendar month, you can implement identical behavior with this FILTER():
Custom MTD Measure:=
CALCULATE(
[Measure]
, FILTER( ALL( DimDate )
, DimDate[Month Number] = MAX( DimDate[MonthNumber] )
&& DimDate[Date Field] <= MAX( DimDate[Date Field] )
Both of these will give identical behavior:
At the day level, they will show the running total for the current month, including the current day.
At the month level, they will show the total for the month.
At the quarter level and above (semester, year, decade, ...) they will show the total for the last month in that period. E.g. for a standard year, they will show December's total.
If these don't work, please provide more details about your date dimension, your data model, and how you are constructing your pivot table, preferably all in the form of a copy of your workbook on OneDrive or similar. -
Regarding Customer Total Sales table
Hi All SAP Experts
I like to know which table will provide me total of each customers for year. an Actual sales for per customer. I know table VBAK with filed Net value. My question is that figure is right figure for each customer. I am looking for total sales. Report requirement is total sales it will not show line itemwise. Just total sales per customer.
Thank youWelcome to the forum. As a new member, I would like to inform you that there are certain rules and regulations applicable to this forum which you can find to your right screen where it has also been indicated that posting basic / repeated query is not allowed. Please search in this forum or Google it with the same text, so that you will find many threads discussed on the same topic. Take the inputs from there and update still if you are not able to resolve. Meanwhile, this thread would be locked.
G. Lakshmipathi -
Reg: i want to get total qty of partculary month
Hi All,
i have developed a report
the output fields are material,plant and qty.
my requirment is for that material and plant what is the total qty in that month
who to sum the qty?
example is
material plant qty
10000023 4210 1
10000023 4210 2
10000023 4210 3
But i want get like this
material plant qty
10000023 4210 6
please can you help
thanks
kaviTry this sample code..
Sort I_ZQMBW_FUJ_VENDQFR by MATNR PLANT
LOOP AT I_ZQMBW_FUJ_VENDQFR INTO WA_DATA.
AT END OF MATNR.
LOOP AT I_ZQMBW_FUJ_VENDQFR INTO WA_DATA WHERE LIFNR = WA_DATA-MATNR.
V_COUNT = V_COUNT + 1.
AT END OF PLANT.
WA_DATA-TOTAL_QFR = V_COUNT.
MODIFY I_ZQMBW_FUJ_VENDQFR FROM WA_DATA TRANSPORTING TOTAL_QFR
WHERE MATNR = WA_DATA-MATNR
AND MTH = WA_DATA-MTH.
CLEAR V_COUNT.
ENDAT.
ENDLOOP.
ENDAT.
ENDLOOP.
Hope this helps... -
How to all customer who are having total sales value more than 10000 usd??
Dear all,
How can we see all customers that are having total sales value is more than a specific amount (Ex: more than 10000 USD)
How to list all customers who's total sales value is more than 10, 000 USD.
Please help me to find the right solution for this problem.
Your help will be highly appreciated.
Best wishes,
Raghu ramDear Raghu ram
Go to VF05N, give just Sales Organization, distribution channel and execute. You will get the entire sales details including currency. Sort in descending order by selecting the value column.
thanks
G. Lakshmipathi -
Calculate total empoyee days (as of present) that have elapsed for each month in a FY
Hello, everyone,
I'm running CF server connecting to an Oracle (11g) db.
I have a table that keeps track of projects (past, present, future) and need a way to sum the days for each project, for each month, that have happened.
For example.
ID -
Name
- Start
- Stop
- Employees
001
Project A
01-Oct-14
31-Dec-14
8
002
Project B
06-Feb-15
21-Feb-15
9
003
Project C
30-Oct-14
29-Nov-14
3
004
Project D
26-Dec-14
16-Apr-15
21
I'm trying to create an overview where the display will have the months of a Fiscal Year go across the page, indicating the number of employee days for each project that have elapsed. (NOT counting the current day). New requirement: To make matters even more complex, there is a related table for the employees showing what dates they actually started and stopped (not every employee starts on day 1 and ends on the last day.. some start a day or two after the project start, etc.)
I'm not wrapping my head around this, for some reason. Mental block. Any ideas?
Someone in another forum suggested a PIVOT. That's above my paygrade (I have never used PIVOT, don't understand how it works, etc.)
V/r,
^_^This may be a good start. Display by Month Year the Average and Sum Dates between Start and Stop by Project.
SELECT CAST (
(CAST(MONTH(Start) AS varchar(2)) + '/01/' + CAST(YEAR(Start) AS varchar(4)))
AS DateTime
AS DatePeriod,
AVG(DateDiff(day, Start, Stop)) AS AverageDaysToClose,
SUM(DateDiff(day, Start, Stop)) AS SumTotalDaysToClose,
Name
FROM Projects
GROUP BY CAST (
(CAST(MONTH(Start) AS varchar(2)) + '/01/' + CAST(YEAR(Start) AS varchar(4)))
AS DateTime
Name
ORDER BY DatePeriod, Name -
Over Charged $20 dollars each month and not being reimbursed
I bought a pre paid plan for $80 dollars in March 2013. Set the auto payment on it with credit card.End of march changed it to $60 plan
After few months saw the bank statements and text messages verizon send they were still charging me $80 dollars though online it showed I had signed for $60 plan.Called them in sept .... (should have called earlier) and they saw "yes I had changed my plan to $60 dollars but the change did not go through seems like a software gliche". She tried for 2 hrs but could not fix it and reassured me that it will be fixed within 72 hrs and reference ticket #<Ticket number removed<. Well they did fix it that my credit card was charged $60 but did not reiemburse for the six months they overcharged me total of $120.Finally I call and say I need an answer today and they say we can give credit for only one month and you will have to dispute the rest with your credit card company.
well for that I need account details from March and since I am prepaid customer I can only view current month details. So I asked her give the details but she refused.
I asked her can you see on your end when I changed the plan and what month and she replied "yes you changed it for April but I cannot give you that info"
So bottom line they mess up you pay and once thay have your money by hook or crook they are not going to give it back even if you have a valid case.
Message was edited by: Verizon Moderator><jeroen25 wrote:
I never authorised this,
can you explain me where the money went to? and how to get it back
Hello and welcome to the Skype Community.
Your account shows that on December 25th 2013 you purchased a Ukraine 800 mins 1 month Subscription. This is a recurring Subscription and will automatically renew each month and charge your account with Euro 63.24 until canceled. You can cancel it at any time by visiting your account page.
TIME ZONE - US EASTERN. LOCATION - PHILADELPHIA, PA, USA.
I recommend that you always run the latest Skype version: Windows & Mac
If my advice helped to fix your issue please mark it as a solution to help others.
Please note that I generally don't respond to unsolicited Private Messages. Thank you. -
Question On YTD Total Sales Query
Hello,
We use this query below to see YTD sales for each of our BP Customers:
SELECT T0.CardCode 'Acct #', T0.CardName Company, T0.Address
' Address', T0.City ' City', T0.State1 State, T0.ZipCode
'Billing Zip', T0.Phone1 Phone, T0.Balance ' Balance',
T1.SlpName 'Sales Rep',
T2.PymntGroup Terms, T3.GroupName 'Group', ((SELECT ISNULL(SUM(INV1.LINETOTAL),0)
FROM INV1 INNER JOIN OINV ON INV1.DocEntry = OINV.DocEntry
WHERE OINV.CardCode = T0.CardCode AND Year(INV1.DocDate) = Year(GetDate()))-(SELECT ISNULL(SUM(RIN1.LINETOTAL),0)
FROM RIN1 INNER JOIN ORIN ON RIN1.DocEntry = ORIN.DocEntry
WHERE ORIN.CardCode = T0.CardCode AND Year(RIN1.DocDate) = Year(GetDate()))) [YTD Sales]
FROM OCRD T0
LEFT JOIN OSLP T1 ON T1.SlpCode = T0.SlpCode
LEFT JOIN OCTG T2 ON T2.GroupNum = T0.GroupNum
LEFT JOIN OCRG T3 ON T3.GroupCode = T0.GroupCode
WHERE T0.CardType = 'C'
We use this query below to see daily Invoice and Credit Memo postings for a selected period:
SELECT 'INVOICE' as "Doc Type", T0.DOCNUM as "Doc Number", T0.CARDCODE as "Customer Code", T0.CARDNAME as "Customer Name", T0.DOCDATE as "Posting Date", T0.NUMATCARD as "Customer Ref #", T0.DocDueDate, T0.DocTotal
FROM [dbo].[OINV] T0 WHERE T0.DOCDATE BETWEEN '[%0]' And '[%1]'
UNION ALL
SELECT 'CREDIT MEMO', T0.DOCNUM,T0.CARDCODE, T0.CARDNAME, T0.DOCDATE, T0.NUMATCARD, T0.DocDueDate, -1*T0.DocTotal
FROM [dbo].[ORIN] T0 WHERE T0.DOCDATE BETWEEN '[%0]' And '[%1]'
My question is -- shouldn't the sum of the YTD column in the 1st Query be the same as the sum of the Doc Total column in the 2nd Query (given that all dates are selected in the 2nd Query)?
This doesn't appear to be the case and I was wondering why?
Thanks,
MikeMike,
The DocTotal may contain Freight and Handling expenses, While the first query only taken the SUM of the line total of the Items.
Thats why they may be different.
Suda -
Regression result Of Sale by product wise and Total Sale
Hi ,
I am using oracle data miner for sale forecasting.
Following are the two scenarios.
1) Created the workflow for regression on sale by each eg APC,GBC,HKJ.
The results are as follows
PRODUCT SALE_FORECASTED YEAR MONTH
----------------------results from the workflow of the product APC
APC 2000 2014 1
APC 3000 2014 2
----------------------results from workflow of the product GBC
GBC 1000 2014 1
GBC 2000 2014 4
===============================================
Sum of Sales Forecasted for year 2014 is 100000 for all the products
2) Created the workflow for regression on total sale of all the products
SALE_FORECASTED YEAR MONTH
5000 2014 1
10000 2014 2
As per me the total sale in two scenarios should match when sale regression is created using oracle data miner.
One more time thanks in advance...
Thanks,
HSHi,
For a background on how you might be able to use ODM for sales forecasting, see Marcos Campos blog on timeseries (link below).
Thanks, Mark
Oracle Data Mining and Analytics: Time Series Forecasting Series -
Report on open sales order ,total sales
Hello Gurus
I am developing a report line item wise of sales order in which i need to get
Suppose a sales order is created on 01.12.2009 for 1000 quantity
billed quantity in december 600
billed quantity in january 200
1) total sales done against this SO line item wise.
2) sales in this month againt this SO
3)open order qty as 01.01.2010
4)last day sales i.e from 01.01.2010 to 20.01.2010 the date of last sales against this SO
so my output should be
total sales = 800
sales in this month =200
open order qty as on 01.01.2010= 400
please tell me the logic
regards
sphoorthi
Moderator message - Please do not post your requirements and ask the forum to do your work for you - post locked
Edited by: Rob Burbank on Jan 20, 2010 10:47 AMHi,
I gather from your thread that the question is not to build a report on a MP yes/no but more on which MP.
Depending on the reporting needs and on how well you are able to combine the 2 cubes in the new MP I would say go for the latter option so you have more control on this one MP (for example if you need to add something that is already available in cubes).
However, when (future!) reporting needs could mean that characteristics need to be added to the report(s) and filtered on that are not in both cubes you will have major problems getting the data properly from new MP and you would be better off using the individuals MP's and combine the data in a workbook or in a web template giving more flexibility.
So you need to really analyze the requirements and decide on the way forward. Keep in mind possible future requirements because for now it could seem these few fields could be enough but new requirements could directly give a problem.
Hope this helps
C. -
Income Tax Increasing each Month
Hi All,
While running Payroll. In June 2011 the Income Tax is 1480/- INR, While we run for July its become 1538/-, in Aug 2280.
Income Tax is Increasing each Month.
I am not aware why this is happening.
Need Help.
Thanks and Regards
Ravi Narayan Padhi
Edited by: Ravi Narayan Padhi on Mar 5, 2012 10:24 AMHi,
Might be maintaining every month Other additional Irregular wage type?
Check employee Earnings Specially Irregular payments such as Over time, Comp off compensation etc.
Or Do have written Any custom rules for Cummulation. those cummulation amount adding every month to taxable income. -
Display Several Sales Orders from Same Business Customer TOGETHER in MD04
Hello
In MD04 is it possible to display several sales orders from same business customer together?
For instance one business customer order bikes for two times.
The Order-No are 12912(50st by 07/08/09) and 12913(100st by 10/08/09).
Normally after runnning of MRP(MD02), the planned orders are displayed seperately in MD04.
I want to display two orders together.
The reason is if some trouble happens in Production(for Ord-no 12912) and it cannot be deliveried on schedule, however Production (for Ord-no 12913) is going without trouble, the final-products for order 12913 should move for 12912.
If you have some good solutions, please share it.
Thank you for your advice.
Regards,Hi Riyolshibashi,
Lets look at the two main scenarios, MTS and MTO.
In MTS, the general display filters are available in MD04. Standard SAP filters do not filter on 'customer'. I suspect this is because the concept would normally be illogical in a MTS environment. Planned orders do not exist to serve a customer, but to serve 'stock'. But let us not think about SAP and their logic.
SAP allows you to create customized filters, in IMG>Production>MRP>Evaluation>Filter>Define Display filter. Within this definition, under the "Addnl Selections' tab, you can tick 'Define addl selections in the transaction'. When you use this filter in MD04 display, then, one of the options available to you is to enter a specific Customer number, and then the display will only show the requirements from this customer. Since you have excluded all other customer's orders, all orders of a single customer will be displayed consecutively. Next to each other.
In the case of MTO, the 'filter-by-customer' concept makes more sense (although, not for the reason you have stated. You would have to find some manual method to convert a production order from supporting one sales order item, to supporting another sales order item. Possible but difficult). Anyway, the above mentioned customized filter would also work in an MTO environment.
Regards,
DB49 -
How to see customers total sales orders value
Dear all,
How can I create a query to see all customers total sales orders value.
I have tried MC+E transaction, it is not giving accurate values when compare for a customer with VA05N report.
moreover it doesn't have filter option.
Please help me to resolve the issue. Your suggestion will be highly appreciated.
Best regards,
Raghu ramHi,
Try S_ALR_87012171 and S_ALR_87012186. or
S_ALR_87012160, select customer lite items only, enter customer number.
Click on dynamic selection (Shift+F4). enter RV in document type field and press execute.
Regards,
Chandra
Maybe you are looking for
-
SQL NLS_UPPER not working correctly for French?
Hi, I have a database containing text in a large number of languages, and am trying to convert characters to uppercase based on their language, but am hitting a particular problem with French. In French, accented characters lose their accents in uppe
-
Deleted calendar entries are not sync to the serve...
I'm using a E71 with MfE. The synchronization works fine except when deleting an item of the E71 calendar. The deleted item on the mobile is not deleted on the server. If I delete an item on the server the sync works correctly and the item is deleted
-
Hello, Can anyone help me out to write a vb.net script. I need to read the column names from excel and based on that column names I need to create a table in database(I have more than one sheet in excel). For each sheet columns will be changing and s
-
I'm developing a large-scale VI with an associated web service VI in 2010 SP1. The "auxiliary VI" is responsible for data capture and analysis as well as communications and data storage. It is fairly large and communicates with the web method VI via
-
PDF printing issues [SOLVED]
Ever since cups got a major upgrade I've had constant problems printing PDF-documents. I've searched and looked for solutions for more than a month. My guess was that I had messed something up by installing some kind of conflicting package that I cou