crystal report formula get sum depend on payment mood - winforms

i'v crystal report have two types of payment mood
1's is Cash
2's is Visa
how get sum of each payment mood in report footer ?
ACT P.Mood Amount
987 Cash 300
988 Cash 200
989 Visa 200
252 Cash 210
253 Visa 310
475 Cash 108
522 Visa 404
i wanna get Sum For cash and for Visa

Group by P.Mood and take the sum of cash and visa in group footer and report footer.

Create two formula fields(intializer,Sum) and place initializer in header section and Sum in details section.
place following code in Initializer FF
WhilePrintingRecords;
numbervar dSum:=0;
Place following code in Sum FF
WhilePrintingRecords;
numbervar dSum;
if (P.Mood} = "Cash" Then
dSum:=dSum+(P.Amount};
Create another field SumofCash and place following code in it.
WhilePrintingRecords;
numbervar dSum;
dSum;
now place this field in Footer Section.
NOTE: Sum field in Detail section and Initializer in Header section will be suppressed.

Option I:
Add a cross-tab object to the report footer section. \
Place the mood in the rows and the amount in the summarized fields sections, respectively.
Option II:
Create a formula field:
//{#cash}
IF {P.mood}="Cash" Then {P.amount}
Create a second formula field:
//{#visa}
IF {P.mood}="Visa" Then {P.amount}
Insert a summary field on each formula in the report footer section

Related

Create a table in Data Studio that shows current/latest value and a previous value and compares them

I have two sheets in a Google Sheet that has historical data for some internal programs.
programs
high level data about each program
each program has data for all of the different report dates
metrics
specific metrics about each program for each report date
Using my example data, there are 4 programs: a, b, c, and d and I have reports for 1/1/2020, 1/15/2020, 2/3/2020, and 6/20/2020.
I want to create a Data Studio report that will:
combine the data on report date and program
show a filter where the user can select which previous report date they want to compare against
the filter should show all of the previous report dates and default select the most recent one
for example, the filter would show:
1/1/2020
1/15/2020
2/3/2020 (default selected)
the filter should only allow selecting one
a table showing values for current report date and values for the report date selected in the above filter
Here is an example table using the source data in my above linked Google Sheet when the report is initially loaded and the filter has 2/3/2020 default selected:
report date
program
id
l1 manager
status
current value
previous report date value
direction
6/20/2020
a
1
Carlos
bad
202
244
up
6/20/2020
b
2
Jack
bad
202
328
up
6/20/2020
c
3
Max
bad
363
249
down
6/20/2020
d
4
Henry
good
267
284
up
If the user selects 1/1/2020 in the filter, then the table would show:
report date
program
id
l1 manager
status
current value
previous report date value
direction
6/20/2020
a
1
Carlos
bad
202
220
up
6/20/2020
b
2
Jack
bad
202
348
up
6/20/2020
c
3
Max
bad
363
266
down
6/20/2020
d
4
Henry
good
267
225
down

Using variables in a richtext with VEEML

In a VEEML story, I would like to comment on a chart displaying the turnover week by week;
Is there a way to display the total turnover of the whole year included in my comments?
Each time you create a metric, a variable with the same is created.
For instance, you create a metric as :
SUM(Amount) as Amount
A variable called “Amount” is automatically created.
To use that variable, you have to prefix the name of the variable by the # character when you want to call it.
For instance, in a Richtext chart, you can display the result of the calculation of that metric as :
The turnover is #Amount €
And you will get :
The turnover is 917 44 154 €

Aggregate metric per date

I have a data source with data formatted like this:
ID
Visits
Charges
Date
Location
33
21
375
2022-01-29
A
34
4285
4400
2022-01-29
B
35
12
2165
2022-01-29
C
36
31
4285
2022-01-30
A
37
40
5881
2022-01-31
A
38
29
4715
2022-01-31
B
39
8
1390
2022-01-31
C
I want to get the aggregated visits of all locations per day, and from there getting the Max value of a day for the time period chosen by the user on a ScoreCard and a Table. At the moment when i choose the max value of the metric visits it only gives me the max value of column (4285), not for the aggregated data per day.
The value i am looking for, in the time period between 28-01 and 31-01 should be 4318 (the sum of all 3 locations for the 29-01, which is the highest of the 3 days)
Thanks!
What I may suggest is to use Pivot Table like this:
You choose Date as your row dimension. Then you choose Visits as metric (aggregation set as SUM).
Remember to sort this table by Visits in descending order. Your maximum value should be on top. If you want to see only this maximum value, you can change size of your pivot table to keep only first value visible.
This should work with additional controls too.

Conditional Formatting based on parameter value

I have a report in Report Builder 3.0 which has 2 parameters, #LocalAuthority and #FiscalYear, neither of these are multi value.
The main basis of the report is a matrix which shows certain figures for Wards within a Local Authority
Ward Fig A Fig B Fig C
Springfield 50 60 40
Grange Hill 20 60 90
I want to try and conditional format my figures based on the previous fiscal year. For example if the above table was showing Fiscal Year 2018/19 and the one below is showing Fiscal Year 2019/2020 I want the text to change colour depending whether there has been an increase or not.
Ward Fig A Fig B Fig C
Springfield 60 60 40
Grange Hill 20 60 80
So Springfield Fig A has increased so I would like it to show red and Grange Hill Fig C has decreased so I would like it to show green.
Have tried this as an experiment
=iif(Fields!Fig A.value > Previous(Fields!Fiscal.value),"Yellow","Purple")
but it would seem you are unable to use 'Previous' in a matrix
I would suggest returning this year and last year data on the same row so that the report in Report Builder has the information it needs to display nicely. In this example, "LY" means "Last Year" and "TY" means "This Year". Report Builder can then choose "Yellow" or "Purple".
Ward LY_Fig_A LY_Fig_B LY_Fig_C TY_Fig_A TY_Fig_B TY_Fig_C
Springfield 50 60 40 60 60 40
Grange Hill 20 60 90 20 60 80

Reference a specific field in the details section to make field on the report footer - Crystal reports

My data/table that appears in the details section is pulled from SQL.
It essentially is a basic table with Row Names in column 1 and dates going across row 1 with the final column being a summation of the data.
The data is 4 rows long and what I am looking to do is create a field that I can put in the report footer that will display the same information as any one of the individual fields that is displayed in the totaled column (last column) of the table / details section.
For example if the 3rd row totaled 12 (in the details section of the report), I would like to create a standalone field that will display the 12 in the report footer.
The details section looks like a table: the report footer breaks out certain things from the details section. I need something that will allow me to reference the individual numbers in the details for example: only pull in the 18 or only pull in the 11 into its own little field on the report footer. Thanks.
Months 1 2 3 4 total
Jack 3 3 4 5 15
Will 4 7 5 2 18
Mike 1 3 3 5 12
Don 3 5 2 1 11
You need to manipulate by storing in the array and retriving one by one.
To store in array:
Create a formula #Total
Shared Numbervar array x;
x:=x+(total);
total
In report footer write one more formula #display
Shared Numbervar array x;
x[1] // first element in the same way 2,3,4 will give you all elements
Let me know in case any issue.

Resources