Home » SQL & PL/SQL » SQL & PL/SQL » Dynamic monthly sales report
Dynamic monthly sales report [message #630460] Sun, 28 December 2014 22:56 Go to next message
ocpsujon
Messages: 8
Registered: April 2014
Location: Gazipur, Bangladesh
Junior Member

Hi,

I wanna use this parameter to execute a monthly sales report. And I want to show those months in the report which are exist between the two date parameters. Please help me.

/forum/fa/12386/0/
  • Attachment: Parameter.jpg
    (Size: 31.89KB, Downloaded 1206 times)
Re: Dynamic monthly sales report [message #630461 is a reply to message #630460] Sun, 28 December 2014 22:59 Go to previous messageGo to next message
ocpsujon
Messages: 8
Registered: April 2014
Location: Gazipur, Bangladesh
Junior Member

Report will show only those months which are between the date parameters.

/forum/fa/12387/0/
  • Attachment: Report.jpg
    (Size: 149.74KB, Downloaded 1196 times)
Re: Dynamic monthly sales report [message #630462 is a reply to message #630461] Sun, 28 December 2014 23:02 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/mv/msg/192454/612487/#msg_612487
Re: Dynamic monthly sales report [message #630465 is a reply to message #630462] Mon, 29 December 2014 00:04 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What tool do you use? I think it is not SQL*Plus (regarding the initial message's attachment which suggests that it is some kind of a GUI).
Re: Dynamic monthly sales report [message #630652 is a reply to message #630465] Thu, 01 January 2015 13:53 Go to previous message
Kevin Meade
Messages: 2103
Registered: December 1999
Location: Connecticut USA
Senior Member
I am going to guess that your are asking about three common problems.

1. how do you get the dates to the report

2. how do you deal with a product/item with no sales during a particular month

3. how do you generate the output in the format shown

First I have to slap you around a bit because of the mistakes you have made that will prevent others from helping you.

1. typical of lazy IT people you have provided absolutely no information yet expect an answer to an ambiguous question.  Where is the definition of the data you are working with for us to see.  To your credit you did provide a result sample which is good.  Littlefoot is not criticizing you for providing results from a non-oracle tool, just asking what tool you are using because that information might play into part of the answer to your question (assuming we are interpreting it correctly to begin with).

2. wanna is spelled WANT TO.  wanna just sounds like someone crying.


OK that was fun, and I hope gives others enough relief that they will now be willing to provide more detailed help. So I will do so now.

Repeating my original opening remarks, I am going to guess that your are asking about three problems.

1. how do you get the dates to the report

2. how do you deal with a product/item with no sales during a particular month

3. how do you generate the output in the format shown


My initial commentary:
#1, depends upon what tool you are using.  You need to somehow craft a query that can go against some row source that exposes the dates you need to use.   You should provide us with this object definition (what is the table describe of your detailed data).

#2, requires that you do a data fill of some kind.  This requires that you either find a list of product/item across which you need to report, or use possible CUBE features to get the result.  You will have to research this to learn about such examples that match your particular problem.  Indeed you may need two lists, one of the list of product/item you want to report across and one on the list of dates you want to sum to.  The Cartesian product of these two will give you the data points you need to generate the matrix you have shown.

#3, will likely require a PIVOT of rows on the date column (or if you are fancy use of the MODEL clause).


As is hinted to above, there are features in the database that may allow you to get your answer without resorting to generating all the summary data points first and then doing join backs to them from the detail data in order to get your data points without missing any. I could put a more detailed example together but that would require me to spend a lot more time on it and frankly I am not willing to spend more time on an answer than you were willing to spend in asking your question.

Kevin




[Updated on: Thu, 01 January 2015 13:54]

Report message to a moderator

Previous Topic: filling summary table from detail and updating the detail with summary reference
Next Topic: Check Time In Query
Goto Forum:
  


Current Time: Tue Apr 23 03:29:56 CDT 2024