Calculate gross profit, yearly sales,monthly sales,weekly sales?

hi all
i try to create procedures according to these conditions 
What are my yearly sales?
What are my monthly sales?
What are my weekly sales?
What are my daily sales?
What is my Gross Profit?
What is my Gross Sales?
this is star schema
now how i calculate yearly sales, monthly sales, and also gross profit.
create procedure spgrossprofit
as
select as grossprofit from dimfact
now which aggregate function i use for calculate above conditions?
any help?

Sorry(ETC) is a Spanish expression = the same for the next option
The correct query:
Year/Month
create procedure spyearlysales
as
select sum(totalsales),Year(Dimtime.date) from Dimtime
inner join Dimfact on Dimtime.Time_Key=dimfact.Time_Key
group by Year(Dimtime.date)create procedure spmonthsales
as
select sum(totalsales),year(Dimtime.date),Dimtime.Month from Dimtime
inner join Dimfact on Dimtime.Time_Key=dimfact.Time_Key
group by Year(Dimtime.date),Dimtime.Month
JM Claudio Dba/Consultor SQL/BI Pasiona - Spain

Similar Messages

  • Plant and Profit center wise Turnover and  gross profit for the Month for s

    Hi
    We need a report Plant and Profit center wise Turnover and
    gross profit for the Month for selected month and GL's
    We are using new GL. but our bi system old version.
    SAP_BW -- 7                      Patch:SAPKW70015
    BI_CONT - 703                    Patch:SAPKIBIIP7
    Do you have any idea or experiences which data source and data target required to full fill this requirement?
    Thanks
    Ramana P

    Hi
    You need to check if you really the report Plant wise and if yes, then check if the Accounting Transactions are maintained at Plant Level in your source system i.e. in R3.
    Ideally it should be Business area or Functional Area or Controlling area which are maintained in Accounting Transactions. You will also the relevant details for these Characterisitics + Profit Center in the NEW GL Accounting data sources.
    Cheers
    Umesh

  • Deactivated "Calculate Gross Profit"

    Hello everyone. I've searched in the notes and in the forum for this topic but couldn't find it. I would be happy to be redirected to answer of my question below:
    We have a client who migrated from 2007A to 8.8 PL 20. The "Calculate Gross Profit" was not activated during that time. This resulted to a blank GP in the marketing documents. Is there a way to recompute or show it (the GP) to the earlier documents in which "Calculate gross profit" was previously deactivated?

    Hi,
    Welcome you post on the forum.
    For your question, I believe you can only create your own report to calculate them by yourself. The historical documents may not be editable.
    Thanks,
    Gordon

  • Return year, quarter, month and week from a date

    I use this to convert a date filed to year_week, year_month, year_quarter and year.
    But when I use it in views I got problem with queries, they take long time...
    Is this the best way to do this?
    Select  to_char(rec_date, 'yyyy') || to_char(rec_date, 'IW') As year_week,
            to_char(rec_date, 'yyyy') || to_char(rec_date, 'mm') As year_month,
            to_char(rec_date, 'yyyy') || '0' || to_char(rec_date, 'q') As year_quarter,
            to_char(rec_date, 'yyyy') As year
    FROM tbltest

    I use this to convert a date filed to year_week, year_month, year_quarter and year.
    But when I use it in views I got problem with queries, they take long time...
    Is this the best way to do this?There is a big difference in showing a date in a certain format (year, month, quater, whatever) and restrict a selection to a certain date.
    My guess is that you try to use the view with something like
    SELECT * FROM myView
    WHERE year = '2007' and year_month = '07'In this case the view is not able to transport the restriction (month='07') to the underlying column rec_date in your table tbltest.
    The workaround is to directly use the date column and stay with a date value on it.
    Like
    SELECT * FROM myView
    WHERE rec_date >= to_date('01072007','dd.mm.yyyy') and
    and rec_date < to_date('01082007','dd.mm.yyyy') andA normal index on the column rec_date can be used in this second case. There is also a workaround for the first case useing function based indexes.

  • How to get current fiscal year/quarter/month/week

    Post Author: [email protected]
    CA Forum: Semantic Layer and Data Connectivity
    Hi friends,
    I have to calculate
    1. current year/quarter/month/week.
    2.Previous year/quarter/month/week.
    please tell the process to achieve the above scenerio's.
    the structure of the fiscal_cal is as  follows.
    Name                                      Null?    Type
    TODAY                                     NOT NULL DATE
    FISCAL_DAY                                         NUMBER(8)
    FISCAL_WEEK                                        NUMBER(6)
    FISCAL_MONTH                                       NUMBER(6)
    FISCAL_QTR                                         CHAR(18)
    FISCAL_YEAR                                        NUMBER(4)
    FISCAL_MONTH_WORK_DAYS                             NUMBER(2)
    sample week data is as follows
    FISCAL_WEEK
         200752
         200753
         209901
    Thanks.

    based on ur target database DBMS you can find a built-in functions be used in the universe designer to get the requirment you talked about, like in oracle
    to_char(mydate,'yyyy') it will return the year in the yyyy format.
    and the same way for the other things you want
    to_char(mydate,'q') return the quarter.
    w return the week of the month
    ww return the week of the year
    mm return the month
    ,, to get the last year
    you can use also a builtin functions
    like add_months(mydate,-12) that return the same date for the last year, and you can do the same operations as before.
    its all related to the DBMS.
    good luck

  • Gross Profit of order Popup screen

    I have set Calculate Gross profit to a default price list. By doing
    The default value is defined in  Administration  System Initialization  Document Settings  General  Calculate Gross Profit  Base Price Origin .
    Now that I have defined which price list to use as base Orgin,
    Am I able to Lock default I choose on Gross Profit of Order Popup Screen
    Is this somewhere in user Security settings

    There is read only selection under Sales Gross Profit.  You may set it as read only to see. However, I don't think there is any authorization for this function alone.  If you could set up user read only, it will stop user to change any.  However, that may not meet your need.  If you just want to block user in changing it, it is possible through SP Transaction Notification.  Check within forum to find out many examples of this SP.
    Thanks,
    Gordon

  • No Gross Profit without Delivery Ticket

    We ship product sometimes using a delivery ticket and sometimes we go directly from the sales order to the invoice, bypassing the delivery ticket. On the invoices that do not use a delivery ticket the Gross profit is 100.00%.
    The items are relieved from inventory and the General Ledger posting is correct. It is only the GP reports or from the individual invoice screen that the GP is wrong. We have selected Calculate Gross Profit and Manage Inventory by Warehouse in the document settings.
    Is there a way to calculate GP if a delivery ticket is not used?

    Hi Kathy,
    GP always depends on the base price & this base price is only dynamically recalculated in the target document when you use 'Item Cost'. If you use any other method, the application will pull the base price from the base document.
    There are 2 EES about GP in the archive here:
    https://psd.sap-ag.de/PEC/calendar/
    Enter 'Gross Profit' into the keyword field & tick the checkbox 'Archived Sessions only'.
    All the best,
    Kerstin

  • Gross profit concept

    Hi Experts,
    Can you describe to me the GP concept in B1 ? is it changed from old version to newest version ?
    Pls advice
    Rgds,
    RK

    Hi,
    Check  the help document for gross profit i.e
    SAP Business One lets you calculate the gross profit according to the method you define during application configuration. The gross profit for each document row is calculated and then totaled for the entire document.
    To calculate the gross profit in a sales document, from the menu bar choose  Goto  Gross Profit .
    Note
    Gross profit calculation is only active if you have selected the Calculate Gross Profit checkbox in  Administration  System Initialization  Document Settings  General .
    End of the note.
    Gross Profit of Order Window Fields
    Note
    This topic includes explanations of some of the fields and other elements in this window.
    End of the note.
    Base Price By Displays the base price in accordance with the price list.
    The default value is defined in  Administration  System Initialization  Document Settings  General  Calculate Gross Profit  Base Price Origin .
    If required, you can choose a different price list.
    Other additional prices are:
    Last Purchase Price u2013 the last price at which you bought the item.
    Last Evaluated Price u2013 the price calculated in the last run of the Inventory Valuation report.
    Item Cost u2013 the current item cost in the relevant warehouse; see  Item Master Data  Inventory Data .
    Gross Profit SAP Business One calculates the difference between the sales price and the base price for each item in the sales document. If the result is negative, the row is highlighted in red.
    Profit % SAP Business One calculates the gross profit in percent.
    When you configure the application, you can choose between two different calculation methods:
    The gross profit can be displayed on the basis of the ratio of the gross profit to the sales priceof the item.
    The gross profit can be displayed on the basis of the ratio of the gross profit to the cost priceof the item.
    If you change data in this window, confirm your changes by choosing Update and OK.
    Note
    When you configure SAP Business One, you can set it up so that an internal mail is sent automatically to specific users when a particular gross profit is exceeded.
    End of the note.
    Note
    If you manage stock using perpetual inventory and the base price calculations are set to Item Cost, the application recalculates the base price if the item cost changes when you copy a base document to a target document.
    End of the note.
    Note
    If you manage perpetual inventory and use the FIFO valuation method, the application always takes the cost of the next available layer, regardless of the quantity.
    End of the note.
    Example
    Qty = 15 Cost = 12 oldest layer (next layer to use)
    Qty = 20 Cost = 40
    Qty = 10 Cost = 9
    If the quantity is 40, the item cost that SAP Business One uses for the gross profit calculation is 12.
    End of the example.

  • A/R Credit Memo Gross Profit calculated incorrectly

    My client created an A/R Credit Memo by opening an A/R Invoice and copying to the A/R Credit Memo.  They deleted all the rows in the credit memo, changed the type to Service, typed a description, added the correct G/L account, and entered the total amount.  The controller of the company looked at the Sales Analysis for the Business Partner by clicking on the graphic icon on the BP form.  He noticed the Gross Profit for the above credit memo showed the exact gross profit as the original invoice from which it was copied, except the value was negative.  The original gross profit was -$73,777 so the Sales Analysis report was significantly incorrect.  I think this is a bug in how the gross profit was calculated on the credit memo.  Am I correct?

    Gordon,
    I totally agree with you.  I told them to not do this any more. 
    I was just wondering if maybe the calculation should be been performed using the final numbers on the Credit Memo instead of using numbers from the original invoice.  Should I raise this issue to SAP?

  • Gross profit for service invoices

    Hi Dear;
    how can i set gross profit for the service invoices?
    best regards;

    Hi Dany,
    Currently Business One can only work with Gross Profit on Items. However, in future release 8.8 version, methods for calculating gross profit have been improved. Users can calculate gross profit for both item and service types invoices.
    Regards,
    Candice Ren
    SAP Business One Forums Team

  • Calculating Years and Months

    I want to have a field that will calculate out the years and months a person has been employed at my business.  I know the calculations for getting the years is:
    if (HasValue(dob)) then
              var currDate_ = Date2Num(currDate.formattedValue, "MM/DD/YYYY")
              var dob_ = Date2Num(dob.formattedValue, "MM/DD/YYYY")
              var diff = currDate_ - dob_
              $.rawValue = Floor(diff / 365.25)
    else
              $.rawValue = null
    endif
    I want to  find it put out so it says 5 years 3 months if that is possible, or something close to that.

    var intYears = Floor(diff / 365.25)
    var intMonths = Floor((diff - (intYears * 365.25)) / 30.4375)
    var strOutput = Concat(intYears, " years, ", intMonths, " months")
    xfa.host.messageBox(strOutput);

  • Sales Analysis - Gross Profit Percentage

    Hello,
    This is a very basic question that hopefully somebody can help me with.
    I ran the Sales Analysis by Customers --> Orders --> for a specific customer.  When I look at the detailed report of the Sales Analysis for this particular customer there are two orders.  I'm confused by how SAP is calculating the gross profit percentage.
    For example, one of the invoices has a sales amount of $76,160.00 and a gross profit of $22,580.00.  The gross profit percentage on the analysis is 42.143. 
    Shouldn't the GP % really be 29.648%?  I used the following formula to calculate this:  (Gross Profit/Sales Amount)*100. 
    What formula is SAP using? 
    Thank you,
    Amanda

    I get it.  It's calculating, however, it's setup on that tab.
    I've been able to calculate both percentages now.
    Thank you so much for your help.  I knew it had to be basic!
    Thanks!
    Amanda

  • Gross profit on sales credit memo of service type

    Gross profit on sales credit memo of service type
    When AR Credit memo of service type is created, should Gross Profit be calculated?
    My client has recently upgraded from 2007 to 8.8 and says that in 2007 GP did calculate and shown on sales analysis for service type credit memos, on 8.8 it does not.
    Please advise if there is a setting (apart from document settings > default GP % for service docs) to make GP calculate on a service type credit memo?

    Hi,
    Have you tried in the demo system? If you can not get gross profit on sales credit memo of service type from there, it would mean not supported.
    Thanks,
    Gordon

  • Daily sales by month and cumulative sales for year

    Hi Experts,
    I have a reporting requirement where I have to show daily sales by month and cumulative daily sales for particular month for the year.
    e.g. If the current month is January then my result shows fine. see below
    Calendar Day
    Net Sales
    Target
    Sales Year
    Actual
    Target
    01/01/2014
    100
    90
    01/01/2014
    100
    90
    02/01/2014
    200
    180
    02/01/2014
    300
    270
    03/01/2014
    300
    290
    03/01/2014
    600
    560
    04/01/2014
    400
    350
    04/01/2014
    1000
    910
    But If I am in the month of Feb and I want to show sales for the month and cumulative sales for the year for just Feb but instead of showing cumulative total from 01/01/2014 to end of Feb it starts again at begining of Feb - See below
    e.g. 
    Calendar Day
    Net Sales
    Target
    Sales Year
    Actual
    Target
    01/02/2014
    200
    190
    01/02/2014
    200
    190
    02/02/2014
    400
    380
    02/02/2014
    600
    570
    03/02/2014
    600
    590
    03/02/2014
    1200
    1160
    04/02/2014
    800
    750
    04/02/2014
    2000
    1910 
    Expected Result - sales for the year shoud show cumulative result from 01/01/2014 - 31/12/2014
    Calendar Day
    Net Sales
    Target
    Sales Year
    Actual
    Target
    01/02/2014
    200
    190
    01/02/2014
    1200
    1100
    02/02/2014
    400
    380
    02/02/2014
    1600
    1480
    03/02/2014
    600
    590
    03/02/2014
    2200
    2070
    04/02/2014
    800
    750
    04/02/2014
    3000
    2820 
    How do I achive this?
    please help.

    What else you need?
    looks like you got #working days for the month, use that metric as of jan 15th

  • How to get the Sales A/R Gross Profit to equal the G/L Gross Profit

    Should the sales ledger (S/L) GP base price be set to 'Std Cost List' (SCL) or 'Item cost'?
    If so, the General Ledger (G/L) uses the 'item cost' and the S/L uses the SCL - two different costs.
    If the SCL and item cost are different (for the same item) how do I balance the S/L GP with the G/L GP when producing financial (G/L accounts)?
    Any help or pointing towards help documents would be gratefully appretiated

    Thank you Shwu very much for taking an interest in my problem.
    We are indeed using Standard costing as our preferred stock costing system (not LIFO or MA) and the 'Standard Cost List' (SCL) is a price list that we are using as a list of all the std costs of our items.  Therefore in each item master we set a SCL for an item and then an Item Cost as well (stockdata tab/item cost).
    We were told to do this , as in 2006 when we installed 'SAP V2005', the gross profit base price (S/L base price) could not select the item cost by default. You could also not change an items 'item cost' either. I believe this is not now the case as in document settings the 'base price origin' can now be set as item cost and you can alter the item cost by a stock revaluation p.s. we are now using V2007.
    So indeed as you say, because at the moment the S/L and G/L look at two different figures and if those figures are not the same the S/L GP will never = the G/L GP.
    Scenario 1 - There are a number of reasons why the SCL does not = the Item cost
    1. Price rises - where we altered the SCL but didn't know we could alter the item cost
    2. Incorrect selection of 'item properties' i.e. not ticking an item as stock which means the G/L does not debit the cost at all.
    3. All our manufactured items have an estimated SCL and item cost, but as we dont use BOMs yet, the std cost may not be accurate. (we need to wait till we do a physical stock check)
    4. We use item masters for each of our direct labour sales so the cost is an estimate of their hourly rate + NIC + down time etc. So this is similar to (3) above.
    5. Supplier carriage on 'goods in' cannot be reflected in the item cost as you never know how much the carriage cost is until you recieve the goods. We therefore set supplier carriage as an 'expense' G/L (purchased not stocked item property)
    6. An advantage of using SCL is that you can allow say 10% for wastage or say 5% for carriage cost, whereas you would want the item cost to be the actual purchased cost of the item
    Scenario 2 - Use only the item cost for S/L and G/L
    1. bar for (6) above it now seems to make sense to select only the item cost for S/L & G/L if we want to close the difference between S/L & G/L GP reports.
    2. But I've just been told that a purchase order stamps the SCL cost down not the item cost. very strange, I'll have to look into this.
    I do hope my answers make some sense and once again thanks for helping me

Maybe you are looking for

  • Portege R700 - Enrolling Fingerprints on Windows 7

    I have been having issues trying to get the Fingerprint Utility to work on my new test laptop. I have created a new SCCM build and associated task sequence which includes the utility. However when I launch the Fingerprint Utility for the first time t

  • Sharing across 2 home netowrks

    Hello, I have both an ethernet network and an home network. The problem is the airport sets up it's own network (10.0.0.x) than the ethernet network (192.168.15.x) and I'm wondering if there is anyway to share a single iTunes library across these net

  • Maintaining frame size when zooming into stills

    I am having trouble maintaining the my frame ratio (video is 16:9) when I am importing stills and adding a zoom motion to them. The stills have been sized properly to the 16:9 ratio when they come in, but once I go the motion controls and set the key

  • How to read json file locally in c#

    Hi I am developing wp8 devotional app my questions are 1. How can i write a code to read the json/text file for each day's devotional locally This is my code below xaml <ScrollViewer>                 <TextBlock x:Name="textblock" TextWrapping="Wrap"

  • When is lollipop due out for the turbo?

    when is lollipop due out for the turbo?