Crystal Reports: Display only the value I want - crystal-reports-xi

I am working on a report that I am trying to display the value that I only want to show. Based on a formula, the report displays the value if the criteria is true, else zero. The report currently shows:
01(group number)
True 170
False 0
False 0
02
False 0
False 0
True 185
What I want is to move the "true" number next to the group number on the report. So it will show:
01(group number) 170
02 185
The field does not show up in the summary option because the formula contains the sum function.

Related

G Sheet - From "Index Filter" to "Array Vlookup Filter"

Try to achieve: Vlookup (Table 2 > Table 1 ) to Match the Nth Occurrence in Google Sheets.
Table 1
TABLE 1
Data
value
a
10
a
20
a
30
a
40
b
50
c
60
c
70
Table 2
TABLE 2
Data
helper: count data occurrences value
a
1
a
2
a
3
a
4
b
1
c
1
c
2
Issue: The FILTER and INDEX combo works fine but (my understanding) can't be converted in an array-formula.
INDEX(FILTER($F$3:$G,$F$3:$F=A3),B3,2)
INDEX(FILTER($F$3:$G,$F$3:$F=A4),B4,2)
INDEX(FILTER($F$3:$G,$F$3:$F=A5),B5,2)
INDEX(FILTER($F$3:$G,$F$3:$F=A6),B6,2)
INDEX(FILTER($F$3:$G,$F$3:$F=A7),B7,2)
INDEX(FILTER($F$3:$G,$F$3:$F=A8),B8,2)
INDEX(FILTER($F$3:$G,$F$3:$F=A9),B9,2)
TABLE 2
Data
data occurrences
INDEX FILTER
FORMULA RESULT
a
1
INDEX(FILTER($F$3:$G,$F$3:$F=A3),B3,2)
10
a
2
INDEX(FILTER($F$3:$G,$F$3:$F=A4),B4,2)
20
a
3
INDEX(FILTER($F$3:$G,$F$3:$F=A5),B5,2)
30
a
4
INDEX(FILTER($F$3:$G,$F$3:$F=A6),B6,2)
40
b
1
INDEX(FILTER($F$3:$G,$F$3:$F=A7),B7,2)
50
c
1
INDEX(FILTER($F$3:$G,$F$3:$F=A8),B8,2)
60
c
2
INDEX(FILTER($F$3:$G,$F$3:$F=A9),B9,2)
70
My attempt: Instead of using INDEX, I am trying to use VLOOKUP (which works well inside Arrayformulas)
ARRAYFORMULA(IF(G3:G9="",(VLOOKUP(F3:G,FILTER(A3:A=F3:F),2,B3:B))))
Data
data occurrences
INDEX FILTER
FORMULA RESULT
a
1
ARRAYFORMULA(IF(G3:G9="",(VLOOKUP(F3:G,FILTER(A3:A=F3:F),2,B3:B))))
FALSE
a
2
FALSE
a
3
FALSE
a
4
FALSE
b
1
FALSE
c
1
FALSE
c
2
FALSE
c
2
FALSE
Error: I get all rows "FALSE"
Any help?
MAP() function may work. Try-
=MAP(A3:A9,B3:B9,LAMBDA(x,y,INDEX(FILTER(G3:G,F3:F=x),y)))
To make it more dynamic for input columns try-
=MAP(A3:INDEX(A3:A,COUNTA(A3:A)),B3:INDEX(B3:B,COUNTA(B3:B)),LAMBDA(x,y,INDEX(FILTER(G3:G,F3:F=x),y)))
you can try this (helper column skipped)
=BYROW(BYROW(D2:D,LAMBDA(aixx,IF(aixx="",,aixx&COUNTIF(D2:aixx,aixx)))),LAMBDA(z,xlookup(z,BYROW(A2:INDEX(A:A,ROW(LOOKUP("zzz",A:A))),LAMBDA(aixx,aixx&COUNTIF(A2:aixx,aixx))),B2:INDEX(B:B,ROW(LOOKUP(2^99,B:B))),)))

How to use AND in Google sheets?

I am currently having hard time creating a formula for my sheet to record values when the following conditions will be met:
I want to give 15% discount from the original price if a Person purchased their ticket online (Online = TRUE), and only applicable for customers who is atleast 50 years old, kindly list the new calculated discounted price in the Discounted Price Column
I have tried creating a formula but I got formula parse error.
Formula used : =IF((B2=TRUE AND D2>50),(E2*0.85),E2)
This is my sample data in the sheet and the expected output on Discounted Price column. Any help will be appreciated.
Person
Online
Physical Store
Age
Original Price
Discounted Price
A
TRUE
FALSE
67
1000
850
B
TRUE
FALSE
16
1000
1000
C
FALSE
TRUE
24
1000
1000
D
TRUE
FALSE
52
1000
850
E
FALSE
TRUE
60
1000
1000
Your formula is almost correct except for the AND operator, the syntax for using AND is as follows: AND(logical_expression1, [logical_expression2, ...]).
I have replicated your data and fix the formula. Please see formula and desired output below
Formula:
=IF(AND(B2=TRUE,D2>50),(E2*0.85),E2)
Data and Output:
References:
https://support.google.com/docs/answer/7014145
https://support.google.com/docs/answer/3093301?hl=en
use:
=INDEX(IF(B2:B="",,IF((B2:B=TRUE)*(D2:D>50), (E2:E*0.85), E2:E))

influxdb query basic percentage calculation

I want calculate a division between a number of values different form zero in a specific table and the number of value equal to zero in the same table
SELECT (count("value") WHERE value = 0 / count("value") WHERE value != 0) * 100 FROM "ping_rtt" WHERE time < now() - 15
Obviously this is wrong and I was wondering what could me the correct way to structure the query.
If your field value consists of just zeros or ones; you can easily calculate percentage as:
SELECT 100*sum(value)/count(value) from your_metric
Or simply use Mean function instead of count/sum.
But if value consists of any arbitrary numbers; there is a tricky way (based on this fact that current InfluxDB implementation calculates zero/zero as zero) to achieve this :) You can first map your field value to zeros and ones and then calculate percentage:
SELECT 100*count(map_value)/sum(map_value) FROM (SELECT value/value as map_value FROM your_metric)
It works properly in my influxdb 1.6.0; suppose there is a metric called metric which contain a field val as:
> select * from metric
name: metric
time tag val
---- --- ---
1539780859073434500 15
1539780862064944400 10
1539780865272757400 7
1539780867449546100 0
1539780880145442700 -8
1539781131768616600 12 0
1539781644977103800 12 0.5
1539781649113051900 12 1.5
as you can see, there are different float number as 0,-8,1.5,0.5 and so on.
we can now map our val field to zero or one:
> select val/val as normal_val from metric
name: metric
time normal_val
---- ----------
1539780859073434500 1
1539780862064944400 1
1539780865272757400 1
1539780867449546100 0
1539780880145442700 1
1539781131768616600 0
1539781644977103800 1
1539781649113051900 1

SPSS: Inconsistent totals due to rounding of numbers

I am using weights when running the data with SPSS custom tables.
Thus it is expected that the column or row values may not add up to row total, column total or Table Total due to rounding of decimals
sample table result:
variable 2
category 1 category 2 Total
variable 1 category 1 45 52 97
category 2 60 56 115
Total 105 107 211
Is there a way to force SPSS to output the correct row, column, or table totals?
expected table output:
variable 2
category 1 category 2 Total
variable 1 category 1 45 52 97
category 2 60 56 116
Total 105 108 213
If you are using the CROSSTABS procedure to produce these figures then you should do using the option ASIS.
To be clear: the total displayed by CTABLES is mathematically correct. However, if you want to display as the total the sum of the displayed values in the rows, instead, the only way to do this is by using the STATS TABLE CALC extension command to recompute the totals using the rounded values.
Here is how to do that.
First, you need to create a Python module named customcalc.py with the following contents
def custom(datacells, ncells, roworcol):
'''Calculate sum of formatted values'''
total = sum(float(datacells.GetValueAt(roworcol,i)) for i in range(ncells))
return(total)
This file should be saved in the python\lib\site-packages directory under your Statistics installation or anywhere else that Python can find it.
Then, after your CTABLES command, run this syntax
STATS TABLE CALC SUBTYPE="customtable" PROCESS=PRECEDING
/TARGET custommodule="customcalc"
FORMULA="customcalc.custom(datacells, ncells, roworcol)" DIMENSION=COLUMNS LEVEL = -2 LOCATION="Total"
LABEL="Rounded Count".
That custom function adds up the formatted values in each row instead of the full precision values. If you have suppressed the default statistic name, Count, so that "Total" is the innermost label, use LEVEL=-1 instead of LEVEL=-2 ABOVE.

Varying validation drop-downs based on varying cell values

I am attempting to have cells in Column “U” deliver different drop-down menus based on the corresponding value in column “D”. I have created 7 named lists:
List_117G
List_152
List_JMET
List_XBAND
List_PACWIND
List_VORTEX
List_ROVER
Those lists will be called up based on 7 values in column “D”:
G
152
J
X
D/E
V
R
So far I have only been able to get this to work for the first category G. When I change the value of column D from G to 152 I no longer get a drop-down. Here is the formula I am using in the List function of validation.
=IF(D6="G",List_117G,IF(D6="152",List_152,IF(D6="J",List_JMET,IF(D6="X",List_XBAND,IF(D6="D/E",List_PACWIND,IF(D6="V",List_VORTEX,IF(D6="R",List_ROVER,)))))))
What am I doing wrong?
When you type '152' into a cell, it will be stored as a number. You can change the format of that number (e.g. display as currency, percentage, date, text, etc), but that value will always be a number unless you specifically use the TEXT formula to display it as text.
In an IF statement, if you want to compare a cell value to a number, you can't have quotes around it.
Example:
A B
1 152 =IF(A1="152",TRUE,FALSE) <----This will return FALSE
1 152 =IF(A1=152,TRUE,FALSE) <----This will return TRUE
1 =TEXT(152,"#") =IF(A1="152",TRUE,FALSE) <----This will return TRUE
Long story short, take the quotes off of the number 152 in your IF statement and it should work.

Resources