How to group the formula field results in crystal reports - vb.net

I want Number of cartons and Pieces currently available in the stock that are about to expire in next 30 days and this is calculated based on expiry date...I have used formula field on crystal report to calculate current stock like "stock.crtns_added - stock.crtns_removed" and "stock.pieces_added - stock.pieces_removed"....Now I want to group by item name, category and expirydate because based on these three columns there can be more than 1 entries in the database....I want that when there are more than one entries the formula should sum up all the cartons and pieces for same item of a category with same expiry date and on report it should display just 1 line showing available cartons and pieces that are about to expire
How can i do this?? How can I apply group clause on the formula field in crystal report to get sum of cartons or pieces for each item based on expiry date??

You can Insert Group for each group you want. You can nest the groups and put the formula inside the inner-most grouping and it should give you sums grouped how you want. You'll end up with something similar to this:
Report Header
Page Header
Group Header 1 (category)
Group Header 2 (item name)
Group Header 3 (expiry date)
Details
Group Footer 3 - summation formulas possibly go here
Group Footer 2
Group Footer 1
Page Footer
Report Footer

Related

How to sum the values based on weeknumber & count the values greater than specific condition based on Weekn

I am trying to create a view that display items changes across a week.
The view tells 10 items changepercentage was postive,3 item changepercentage was negative and 4 item changepercentage no change during a week.
View details
To generate the view,my thought process was
Sum the values of the field based on the weeknumber
Count the values if <0,>0,==0 based on the weeknumber
But not able to figure the calculated field to find sum & count.
I am attaching the workbook
https://public.tableau.com/views/CountSum/SumCount?:language=en-GB&:display_count=n&:origin=viz_share_link

How can I get the Total field to display only once instead of on change of every group?

I have grouped my formula by my date field per month but why does it show in all the months (via lookup table)?
Perhaps there's something missing or wrong with my formula? This is its code:
(Sum ({tblDates.TotalFuelSales}) + Sum({tblDates.TotalMotorOilSales})) -
(Sum ({tblDates.TotalOperationalExpenses}) + Sum({tblDates.TotalMotorOilExpenses}) + Sum({tblDates.TotalFuelExpenses}))
Thanks!
Issue here is Sum ({tblDates.TotalFuelSales} will give you the grand total so for every date group you the same value... if you wish to get according to date grouping then your syntax shoukd be something like below.
Sum ({tblDates.TotalFuelSales}, {your date grouping})
Above is just an example check syntax when you apply... similarly apply to all fields in formula
If you dont you want to see the Total for each month then you should place #Profit formula on the Report footer. It is currently on the Group Footer section so it will show on change of every group.
I would do it this way:
1) Right click every field on the Group Header and Insert Summary (Sum) on the group footer for each field. So you have five Summary fields on the Group Footer section.
2) Put my Profit formula in the Report footer section, use those summaries in the formula to get my totals.
This is assuming you want Profit to appear only once.
You can skip doing the Insert Summaries part, and directly include the Sum({Fields}, {tbl.Date_group}) in your Profit formula.

Crystal Report formula to reset a count?

I want to get the total qty of items sold by year by each part number. So far I have the following formula:
if {INVOICE_DATE} >= DateTime(2012, 01, 01) and
{INVOICE_DATE} <= DateTime(2012, 12, 31)
THEN Sum ({INVOICE_QTY)
Now, that formula just sums all the parts sold in that year. What I need is for it to reset the sum as it count through each invoice and by each part. How can I do this?
Your formula is not doing what you think it is. For each row in your report (I'll assume that this is by an Invoice_ID or something along those lines) this will simply display the grand total sum of {INVOICE.QTY} for all invoices in the report and will not change from row to row.
To get something that is like your image, you need to create a Cross-Tab object and configure it such that its rows are based on the Product_ID, the columns are based on Invoice_Date and set to be printed "for each year", and set the "Summarized Fields" to be the sum of {INVOICE.QTY}.
I guess you are not grouoing the report hence you are getting the grand total using that formula. What you can do is:
First create a group by Year and then by Part.
In details place your fields that need to be summed and supress the detail part.
Take sum in group footer 2 (For parts summary) and Group footer 1 (For year summary).

How to group within groups in Access

I've been trying for a while and I'm just about to give up. I need to prepare a report that displays Item Numbers, the line they were produced on, and their production date, among other things. So, as you would imagine, each row contains a line number, item number, production date, and information regarding the number of items planned and produced for that entry.
I need to group the rows by line first, that was simple enough, afterwards, I need to group them by week, that also worked like a charm, except the dates were not really in order after this. I would need to apply a sort but by day this time. This works well but it's the next step that causes the most trouble. I also need to group the runs of items produced. For example:
Day - Item
Day 1 - Item A
Day 2 - Item A
Day 3 - Item A
These would be grouped with a footer counting the number of items produced for those consecutive entries. However, sometimes production looks like this:
Day - Item
Day 1 - Item B
Day 2 - Item B
Day 3 - Item A
Day 3 - Item B
I don't see a way to have the items ordered in a particular way that they can be grouped since I'm already ordering/sorting them by date because the date order is messed up by the first group. If I'm to group items at that point I would get one group header/footer per row, meaning it's not working at all.
My client suggests I make it so that when Access "notices the item number changes it gives a total". While that's wonderful in words, it implies that the rows should be sorted by item number and date. He will produce item A for three days, then produce item B for 2 days but part of the problem is that sometimes he will produce A for two and a half days and start B on that third day (following A) so if it's ordered by date, it may put one row above the other since they are on the same day. To my knowledge there is no real way to have Access to just "know" which products are produced first so as to group them after the item number changes. Of course it can keep the order they were entered in but if I ever need them sorted, that order will be lost.
I'm not sure if this is at all possible with this kinda of table structure. If not, can anyone suggest an alternative table structure? Or perhaps there's a way to have the first group by to not mess up the dates, which would allow me to remove the sort by date (although I'm not sure that it would work even if I could do that).
#Steve Kass
Day - Item
Day 1 - Item B
Day 2 - Item B
Day 3 - Item B
Day 3 - Item A
Day 3 - Item C
Day 4 - Item A
Day 5 - Item C
This is how it's laid out in his Excel sheet:
Day - Item
Day 1 - Item B
Day 2 - Item C
Day 3 - Item C
Day 3 - Item A
Day 4 - Item A
Day 4 - Item D
Day 5 - Item D
I've picked letters that represent the alphabetical order of the actual item numbers.
#Abe Miessler, Query so far:
SELECT Planned.Line,
Planned.[Production Date],
Items.[Item Number],
Items.[Bottles/Pallet],
Planned.PQ1,
Planned.AQ1,
Planned.PQ2,
Planned.AQ2,
Planned.PQ3,
Planned.AQ3
FROM Items
INNER JOIN Planned
ON Items.ID = Planned.ItemID;
#David-W-Fenton: Well I'm being asked to have a production summary per run. A run would be described as consecutive production of the same product. Products are produced on one of two lines and there can be multiple entries per day. The report must be grouped first by line so that each group shows entries for that line. That was done with a simple grouping. Within each line grouping I'm required to separate entries by week. Now, within each week, the days are not appearing in order. If the days are not in order we will not see a run simply because a run will most likely happen with consecutive days. One product will be produced for 3 days in a row for example, if these days are mixed up with the other days of the week, there will not be a consecutive, identifiable run. To have the entries in each week be in the correct order (by day) I applied a sort. What I've noticed is that after applying this sort each entry is handled as a separate "group" but without a header/footer. This results in not being able to group by product number afterwards since each entry is within its own "group".
I think you're asking for something impossible. But just in case you aren't, please let us know what order you want if these are your rows:
Day - Item
Day 1 - Item B
Day 2 - Item B
Day 3 - Item A
Day 3 - Item B
Day 3 - Item C
Day 4 - Item A
Day 5 - Item C
You say in a comment that you started with this:
Group by=>line
Group by=>week
Group by=>product number
...but it didn't work "because after grouping by week, they're grouped by week but within the week they're no longer ordered." So you (correctly) added a sorting group, thus:
Group by=>line
Group by=>week
Sort by=>day
Group by=>product number
But you say:
Now it's in order and you can see
consecutive days with the same
products but grouping results in each
row being grouped separately.
Where are the controls displaying the data? In the detail or in the group/sort header? It makes all the difference in the world. To display all records, you use the DETAIL. To show summary data, you use the HEADER. It sounds to me like you're putting your controls in the header instead of the detail.
Can you take a screenshot of your report in design view and insert it into your question? Without it, I don't see how to get any further.

Crystal Report in VB.net

Im creating a report using crystal report in vb.net.
The report contained a crosstab which I have 3 data:
1. Dealer - row field
2. Month - column
3. Quantity Sales - summarize field
How can I arrange this by ascending order based on the
Quantity Sales - summarize field?
thanks
Depending on how you're working with it, you can adjust the input to order the data ascending.
SELECT customer, sum(amountdue) AS total FROM invoices
GROUP BY customer
ORDER BY total ASC
If you're doing in a way that you can't change that information, could you provide a little more insight?
Note that other Business Objects products order on the total of a summary field when sorting a cross tab by it's values. I forget how CR does it exactly.