How to Sum the Group value and subtract of received value? - crystal-reports

I am generating the crystal report in which grouping by Type ,their are two types income and deduction.Each group have it sum(total).I have applied sum({table.field_to_summarize},{table.field_you_are_grouping_on}).Net amount should be soon at report Footer, sum of income - sum of deduction gives net Amount,
but it give me 0 as value
Group
Income
50
40
10
100 <- sum of the Income
Deduction
40
10
50 <- sum of the Deduction
net 50 <- sum of the Income - sum of the Deduction

Try using running total.
Create two Running total formulas Each to summarize based on type(Income and Deduction). While creating running total in the evaluate condition use "Formula" like
IF Type = "Income" Then True
and similarly for deduction. Place these formulas on the group footer.
Now for your Net Amount formula simply do Runningtotal1 - Runningtotal2 and place it in the report footer.
This should give you the result.
Hope this helps!

Related

Calculate Grand Total from my total of Each Group in my SSRS Report

I want Grand Total of Each Group total as shown in image, but i dont want to repeat my grand total so i have placed it outside of my Group1. How to calculate Grand Total outside of my Group1.
My Report Structure is as Below -
In Quantity Field which is showing -86 , expression i wrote is as follows -
=Last(SUM(Fields!BalanceQty.Value,"Group1"))
In the image - result of Quantity is -86 , but my required Output is 41 i.e. 26 + 16 + 30 -31 .
Any help would be appreciated.
So if I understand correctly, you want to sum the values shown in the cell directly above the grand total cell (in your design).
If that's the case then get the textbox name from the 'cell' you want to sum and then do
=SUM(ReportItems!myTextBoxName.Value)
dont you have on grouping "add totals after" or "add totals before" option. This will show you a grand total; plus and sub-totals for each category.

Pick group totals, grand totals and normal summarization in Tableau

I am trying to calculate average of 2 columns in another column in Tableau but difficult part is grand total is not getting average instead it is the sum of 3rd calculated field.
A B Calculated field
10 5 2
6 3 2
T 16 8 4 (Here I should get 2 instead it is taking sum of column)
Here I am unable to write separate formula for row totals and grand totals, Only one formula (Calculated Field) is allowed and when I am dragging on sheet it is by default aggregating to sum.
Note: I am expert in Crystal and BO but beginner in Tableau.
Update
Code used for LoD
{FIXED [Product Category]: AVG([Sales])}
Below image is what I got after implementation I have tried with 2 columns but the result is same if I use only one column (I am trying to get the average of sales)
You are almost there - the Grand Total by default does a SUM function you just have use the Total All Using --> Average option.
Output : Level wise SUM(Profit) later averaged across columns and rows. (Show Column Grand Total & Show Row Grand Total active)
Update: Answering the question below. To get the Row-wise avg (which is Cat1-vag in this case) you could just drop the measure and change it to AVG(). Since you needed in a Calculated Field you could use a Simple FIXED LOD. You can also uncheck aggregated measures from Analysis dropdown and have no Dimension in column or row like unlike what this example shows and still get three different averages. Cheers.
{FIXED [Cat1]:AVG([Profit])}
Check out this very smart work around from Joe Mako.
https://community.tableau.com/thread/112791
create a calc field like:
IF FIRST()==0 THEN
WINDOW_AVG(SUM([Sales]),0,IIF(FIRST()==0,LAST(),0))
END
duplicate your Category field
place "Category (copy)" on the level of detail
set the compute using for the calc field pill to use "Category (copy)"
The window function in the calculated field only takes into account what's in the view, and aggregate based on those number.

Crystal Reports, calculate sum field

I need your help, how can I know the total(sum) in a field that is itself the joining of two formulas:
Main formula:
sum(#weight)
Formula 1:
#open = if ({OrderRel.OurReqQty}
- (Sum ({ShipDtl.OurInventoryShipQty}, {OrderRel.OrderRelNum}))
- (Sum({ShipDtl.OurJobShipQty}, {OrderRel.OrderRelNum}))) < 0 then 0
else
{OrderRel.OurReqQty}
- (Sum ({ShipDtl.OurInventoryShipQty}, {OrderRel.OrderRelNum}))
- (Sum({ShipDtl.OurJobShipQty}, {OrderRel.OrderRelNum}))
Formula 2:
#weight = {#open}*{Part.NetWeight}
I can't calculate the sum field by referring the #open and #weight formulas.
You can't calculate the sum by just using sum function, Instead you may use running total or write a formula to calculate sum of the weight function like sum one by one for each group and then reset it at start of the group
Make a third formula that uses the logic {#open} + {#weight}. This will get the sum of the two values per record.
If you're looking for a grand total of every instance of Open and Weight on the report, use the new formula as the field to summarize a Running Total. Set the Type of Summary to sum, evaluate for each record, and reset never.

Crystal Reports combine sum total with percentage calculation as string

I have a table of data in Crystal, using the summarise feature I can add a sum total at the bottom of each column but I'd like to add the percentage calculation in brackets next to the sum total.
For example I have,
Column A 432
Column B 191
Is there a formula I can use to show "SumColumn B (SumColumnB/SumColumnA %)"?
Managed to resolve this with the code below:
totext(sum({table1.ColumnB},{table.Site}),0)&" ("&totext(sum({table1.ColumnB},{table1.Site})/sum({table1.ColumnA},{table1.Site})*100,2)&"%)"
Using the table.Site to sum each group separately.
Resulting in following output:
191 (44.21%)

Can't Sum Formula in Crystal Reports

I am trying to sum two different formula fields in Crystal. It will not let me select them from the Sum. The first formula is
if Sum ({tblPostedLine.pli_QUANTITY_SHIPPED}) >= 1
then {tblPostedLine.pli_NET_PRICE}
else ({tblPostedLine.pli_NET_PRICE} * -1)
I am trying to take a price and make it a negative value if the quantity is a negative value. I then want to sum the amounts to get a net amount that was shipped.
The other formula is
If PreviousIsNull({RodsvwCatalogAnalysis.pro_PROMOTION_CODE})
or ({RodsvwCatalogAnalysis.pro_PROMOTION_CODE}) <>
Previous({RodsvwCatalogAnalysis.pro_PROMOTION_CODE})
then {RodsvwCatalogAnalysis.pit_AREA_PER_PAGE} else 0
With this formula, I am trying to sum at a group level, not the details level. When I just sum the group level number, it is adding it every time the value is listed in the details as well.
I am open to any suggestions.
Thanks!
For the first scenario,
Create 1 variable formula in detail level to hold with your requirement.
for e.g.
#NetPrice , formula if {tblPostedLine.pli_QUANTITY_SHIPPED} >= 1 then
{tblPostedLine.pli_NET_PRICE} else ({tblPostedLine.pli_NET_PRICE} * -1)
using running total field feature in your Field Explorer to sum up the value and place
your group footer.
For the second scenario, I believe it relate to promotion group and again you could use the running total field feature to evaluate the sum condition and reset the value when condition are meet like field value change.