Tricky getting average for price when summing extended and qty - crystal-reports-xi

The data we display is summarized by order type. Data looks: where ABCDE is the sum of one or more rows with same item #.
Item Order Type QTY PRICE EXT. PRICE
ABCDE INT 10 $100
I am not displaying price because this row is a summary of several in time frame selected. Price on these items changes in time or for customer.
So What I can do is give an average price.
I have 2 formulas but the result is not correct. all result is same number 91,979.00
formula 'new avg' sum({DATA_WHSV3.ITEM_PRC$}) / count({DATA_WHSV3.ITEM_PRC$})
then If {#new avg} > 0 then
sum({DATA_WHSV3.ITEM_PRC$})/{#new avg}

You can use a Running Total Field to do the average for you. So say your report is grouped by Item# you would create a new Running Total Field.
Running Total Name: RTotal0 (can be anything, this is just the default)
Field to Summarize: {DATA_WHSV3.ITEM_PRC$}
Type of Summary: average
Evaluate: For each record
Reset: On change of group: Group #1: DATA_WHSV3.ITEM_NUMBER
Then you can drop the {#RTotal0} into the group footer along with the other details for that item number and it should be the correct average.

Related

How to not take Null values while doing table calculation but keep them for the aggregated total

Background:
I have a cohort analysis table that shows month of year on the Y axis (Rows) and Difference from next month as my X axis (columns). With Customers as my measure, you see values from 0 to 12 on the column side, showing all the conversions from that particular month and people who did not make a conversion are shown as Null.
Problem:
As I have a table with column showing Null, 0,1,2... 8 showing values, and the total of this shows me my cohort size. So as a customer, Null is important as it shows the size of the total group. But I want to have a percentage of each group and show the cumulative growth of the group without taking the null group.
Summary
I want to show a cumulative percentage growth but not take my first column (that is the null values) but keep it to have the totals show correct value.
The following image can help you understand
For January 2022,
You have the total value of each column
You see the individual percentage of that column/ total
You see the cumulative percentage growth total
Result to see: if we can do cumulative percentage total without taking the Nulls.
Follow up Clarification from Image:
The expected answer should look like this
For 0 --> 3.9%
For 1 --> 7.8% (3.9%+3.9%)
For 2 --> 9.5% (3.9%+3.9%+ 1.7%)
As you can see, the percentage value takes the total cohort size and shows the 3.9%,which is the correct value and doing cumulative by excluding the Null value % that is 87.1% (therefore hiding the Null value column)

Deal price at google sheets

I have a data of orders where there can be multiple products per one order. I struggle to automatically compute the total order price. Didn't find any formula for it.
There is what I mean:
table example
In the last column I want to see the sum of product prices with the same order number.
You can just use Sumif:
=ArrayFormula(if(A2:A="",,sumif(A2:A,A2:A,C2:C)))
Note:
At time of writing Sumifs can't be used this way so you can't add an additional condition to the formula.
To avoid getting multiple duplicate values in Total Price column (D).
My suggestion is to add another sheet to display Total Price by order number.
If you add Sheet2 and put the following formulas inside:
in cell A1 put this formula={"Order Number";UNIQUE(Sheet1!A2:A)}to look in Sheet1 and get only unique order numbers.
in cell B1 put this formula={"Total Price";ARRAYFORMULA(if(A2:A="","",SUMIF(Sheet1!A2:A, A2:A,Sheet1!C2:C)))}to calculate for each unique Order Number the total sum of all product prices.
You will get this clean table showing you the total price for each order number:

Tableau calculating variances (division) of two calculated (countif fields)

Tableau is giving me a hard time, trying to compare two items by percentages. I need to display the percentage different between the number (couintif) of string items based on condition.
Basically, I wrote two calculated fields like:
Calc field #1
IF [Outcome] = "Complete" Then 1 Else 0
Calc field #2
IF [Outcome] = "Pending" Then 1 Else 0
and a third field to get the percentage of pending sales to completed sales
Calc percentage
SUM(Calc field #1 / Calc field #2)
But it's not working. The first two fields work fine, validated them with dataset, but the third calculation doesn't work and always outputs 0
The formula for Calc percentage should be
SUM(Calc field #1) / SUM(Calc field #2)
As both the calculated fields are computed row-wise, it is important to aggregate while using it in a formula.

Ho to do the automation to calculate the quantity left, profit and loss when there is new data input in google sheet?

Hi everyone,
I have 4 ranges of data:
A1:C5 (Product In Storage), there will be new data input if there are other new products coming in.
E1:G8 (Sales), this is the record for all the products that are being sold, there will be new data input also in the future.
I1:K5 (Summary of Sales), this will record the Quantity Left in the storage and also the total Profit or Loss after doing some calculation based on A1:C5 and E1:G8. The number of rows for Summary of Sales should be equal to the number of rows of Product In Storage (So I'm using query function highlighted in yellow).
M1:O5 (Desired Output), this is the final result that I want to achieve for this task.
My goal is to calculate the Quantity Left & Profit or Loss in Summary of Sales automatically once there are new data input in Product In Storage & Sales.
I'm not sure how to do it because the number of rows in Sales is a not a constant. In this example, the are 2 rows data for Product ID: 1001.01 & 3 rows data for Product ID: 1002.01. In the future, after the remaining quantity (34) for Product ID: 1001.01 had been sold, it need to be included in the Summary of Sales as well.
I attached the google sheet link below in case you need it: https://docs.google.com/spreadsheets/d/17coke3-oyDRLHgz79PDl3KX68kFOEte-aynVe-xEITU/edit?usp=sharing
Is there anyway to do this without using the google apps script? Any help will be greatly appreciated!
For your example,
J4 -> =SUMIF(A:A,I4,C:C) - SUMIF(E:E,I4,G:G) means;
(First sumif, get inventory) Whenever you see I4 in A:A column, get the C value on that row and sum all of them.
(And minus)
(Second sumif, minus sales) Whenever you see I4 in E:E column, get the G value on that row and sum all of them.
(Result) = Get storage quantity and substitute the sales quantity.
K4 -> =ArrayFormula(SUMPRODUCT(IF(E:E=I4,F:F*G:G)) - SUMPRODUCT(IF(A:A=I4,B:B*C:C)))
means,
(get income) if you see I4 on E:E column, then get the sum of (F*G)
(minus)
(get expense) if you see I4 on A:A column, then get the sum of (B*C)
But if i were you, to keep things more simple, i would put =Quantity*Price right of your tables and you can solve problems with only =SUMIF formulas. FYI, this will update everytime you change a value from table so when things get nastier, it will become slower indeed. When that time comes, a VBA macro button or Formulas->Calculation method will save your day.

In Google Sheet, how do I SumIf the product of 2 column multiplied

I basically want to conditionally sum all the rows that have same customer name. But I want to multiply the item price and order count to get the total order price. I have an equation like this:
=SUMIF(Orders!A$2:A$100,A2, MULTIPLY( Orders!H$2:H$100,Orders!D$2:D$100))
Where:
Orders!A$2:A$100 is the Customer Name Column
A2 is the current Customer Name Criteria
Orders!H$2:H$100 is the Order Price
Orders!D$2:D$100 is the Order Count
This unfortunately does not work, how do I do this?
=SUMPRODUCT(--(Orders!A$2:A$100=A2),Orders!D$2:D$100,Orders!H$2:H$100)

Resources