Sum Formula Crystal Reports Inquiry - syntax

Ok, say I have a subreport that populates a chart I have from data in a table. I have a summary sum field that adds up the total of each row displayed. I am about to add two new rows that need to be displayed but not totaled up in the sum. There is a field in the table that has a number from 1-7 in it. If I added these new fields into the database, I would assign a negative number to this like -1 and -2 to differentiate it between the other records. How can I set up a formula so that it will sum up all of the amount fields except for the records that have an 'order' number we will call it of either -1 or -2? Thanks!

Use a Running Total Field and set the evaluate formula to something like {new_field} >= 0. So it will only sum the value when it passes that test.

The way to accomplish this without a running total is with a formula like this:
if {OrderNum} >= 0 Then {Amount}

Related

Google Sheets: When there are dupe values in a column, determine which value should be included by comparing corresponding dates in a date column

I have a dataset with an ID column and Edit Date column. There are some duplicate IDs but the Edit Dates will be different for each dupe ID. I created 2 helper columns to help me determine if I need to include the row of data in a separate analysis I'm working on. I included Notes in the sample dataset, with a short description of each column.
I want to include any rows that:
Have Count value = 1
or
Have Count value >1 but the Edit Date value for its corresponding ID is the lowest value of all Edit Dates listed in all rows this value is in
I don't want to include any rows that:
Have Count value >1 and Edit Date value that not the lowest Edit Date for the corresponding ID
So far all I have is the first part...I'm having trouble figuring out how to go about the comparison when Count >1, so any help would be greatly appreciated.
This is all I have so far...
=IF(C2:C=1,"YES",...?)
Thank you in advance!
try:
=ARRAYFORMULA(IF(A2:A="",,VLOOKUP(A2:A&B2:B,
{SORT(A2:A&B2:B, B2:B, 1), IF(COUNTIFS(SORT(A2:A, B2:B, 1), SORT(A2:A, B2:B, 1),
ROW(A2:A), "<="&ROW(A2:A))=1, "yes", "no")}, 2, 0)))

How to slice the dataset in Python in specific intervals

I have a dataset with n rows, how can I access a specific number of rows every specific number of rows through the whole dataset using Python?
For example, in 100 rows data set and I want to access 10 rows every 10 rows, like 1:10, 20:30, 40:50, 60:70, 80:90
I could think of something like this
df.iloc[np.array([int(x/10) for x in df.index]) % 2 == 0]
It takes the index of the dataframe, divides it by 10 and casts it to an int. This basically just removes the last digit in this example.
With the modulo statement the first 10 rows are True, the next 10 False and so on. This is then used with iloc to get just the lines with the True value.
This requires a continuously increasing index. If for example some rows were already filtered out this is not the case. reset_index can be used to reset the index.

PowerPivot DAX Max of two values

I have two columns and I need to extract the maximum value of those two for every row in my table. I have looked at the Max, Maxx and Maxa, but they all have input for just one column.
How would I write following expression in a Calculated column:
=max(
Table1[Column1],
Table1[Column2]
)
Actually, you should write the formula exactly as you described:
=max(
Table1[Column1],
Table1[Column2]
)
MAX function in dax exists in 2 versions: one takes a single column, the other takes 2 singular expressions.
Instead of MAX, you can just use a simple IF to achieve what you want:
= IF(Table1[Column1] >= Table1[Column2], Table1[Column1], Table1[Column2])

Displaying Max, Min, Avg across bar chart Tableau

I have a bar chart with X axis as discrete date value and Y axis as number of records.
eg: x axis (Filtered Date)- 1st Oct, 2nd Oct, 3rd Oct etc
y axis (Number of Records)- 30, 4, 3 etc
Now, I have to create a table to get Max, Min and Avg. Value of the 'Number of Record'.
I have written a Calculated Field as MAX([Number of Records]) to get the maximum of Number of Records in this case 30 but I always get a value of 1.
How do I define the values to get max, min and avg. ?
Thanks,
Number of Records is an automatically calculated field that tableau generates when importing a datasource. You can right click on it and see the definition of the calculation: 1.
As you currently have your field defined, tableau will look for the maximum value of the column. It will always be 1 because that is the only value in that field for every record.
It sounds like you are actually trying to calculate the maxiuum of the sum of the number of records for your aggregation level (in your case date). You should be able to easily accomplish this using Level of Detail (LOD) expressions, or table calculations. Something like the following:
WINDOW_MAX(SUM([Number of Records]))

Adding different row values for Birt

I got this selection of data from my sql:
I would like to add Cancelled, Disputed and Resolved together and then divide the result with the total shipped. All of this should be done with an Expression.
So x / 303 where x is the sum of the desired values.
Goal would be to get a % where I can tell how good my shipping is.
I would then like to display the result in a text label next to a graph.
How do I do that?
You should use computed columns in your data set:
Add a SUM on the column Total and a filter only matching the rows based on the column Status you want to select. The expression should look like:
if (row["Status"] == "Cancelled" || row["Status"] == "Disputed"
|| row["Status"] == "Resolved")
true
else
false
create a second computed column only containing the "Total" value where the Status is Shipped.
if (row["Status"] == "Shipped")
row["Total"]
Then create a third computed column where you divide both computed values and you are done.
row["sum"] / row["shipped"]
create a new parameter and refer the image
create new static values and allow multiple values to be selected.
So, accordingly edit your SQL queries

Resources