How to implement a conditional fomula in Crystal Report - crystal-reports

I have a table named tblRecovery with 4 column. ID, LStatus, Amount and RecoveredBy I created a formula to sum Amount Column where LStatus Column value is "WCL". I use following code.
It sum all value of Amount column without condition. I want to sum amount column if Lstatus Column value is "WCL". How can I do that?
if {tblRecovery.LStatus}='WCL' then sum({tblRecovery.Amount})

Crystal Reports formulas work on a per-record basis.
Your current formula shows the sum of tblRecovery.Amount on every single row where LStatus='WCL'.
To get the desired result, create a formula-field with following formula and the create a sum of it:
if {tblRecovery.LStatus}='WCL' then
{tblRecovery.Amount}
else
0

Related

Crystal- Reports: Exclude a field value from running total

In crystal reports is how can one exclude a field value from running total. This field is not suppressed however we donot want to add its value to the sum total.
I would suggest you to create one more column for the calculation purpose and then place after the last column and write below formula:
if column="NonDelivery"
then value
else 0
Now take the sum of this column and then place the sum below your mail value column and supress the newly created column.

Tableau creating a calculated percentage (non-aggregate) based on an aggregated total

Either I am the first person to ever need to display percentages in Tableau or I do not know what to search for! I highly suspect it is the latter...
I believe what I am attempting to ask is how to make a calculated non-aggregated field by dividing by an aggregated number. Although I would prefer just to be able to display the percentages instead of a whole number.
This is how I would do it in Excel:
The data that already exists is Column A and B. In Tableau these would be non-aggregated. What I need to do in Tableau is to generate what is column C (also non-aggregated) because it does not exist in my data. In excel, all I did to get the aggregate number (total) of column B was:
sum(B1:B4)
And for the column C:
=B1/$B$5
But I can't seem to do this at all in Tableau. When I try to use the same syntax, I get an error message: "Cannot mix aggregate and non-aggregate arguments with this function."
Instead of having a calculated field, you can use a Quick Table Calculation on the column.
Right-click the pill of your data > Quick Table Calculation > Percent of Total. This will show the percentages instead. If you want to keep both, just duplicate column b first and then add the table calculation to the new column.

Expression to create SSRS column dynamically

I need an expression to take an existing column and recreate this column over and over before another column/s where the column name contains either "Monday" or the date of the column falls on Monday.
The reason I need this expression is to repeat a header column in a pivoted report that is pivoting start/enddate parameter. So if a user selects to run the report for this month, they should get 31 columns (for each date/day) and header repeating before every Monday.
Make sure your dataset contains all the dates in your date range. If not create a date table and cross join to it. Don't pivot the results, let SSRS do that bit. Once your dataset has all the dates, you can use a matrix in your report and drop the date colum into the column group. This will give you one column for each date in your dataset. I'm not at my PC at the moment but if you need any more help, show an example of your dataset and I'll put together a quick sample report.

How to Sum Conditional Data in Crystal Report

I have a table called tbl_sale and there are seven columns in this table
I want to sum those quantity which is returned to the shop which is in negative
so that I show how many quantity has been returned
Create these formula fields:
// {#fields}
{table.amount_0}+{table.amount_1}
// {#negative}
If {#fields}<0 Then
{#fields}
Insert a summarized field on the {#negative} formula.

SSRS Tablix Row Number into different Tablix

I've got an SSRS report with two tables. In the first table, I've got a row number column, that is calculated based on the RunnningValue for the CountDistinct on the tablix.
What I need, is a row number column in the second table, that begins with the next number after the last number in the first table. So, if table 1 has 15 rows, table 2 should begin at 16. I figure i can do another RunningValue + the max value from the other table, but no idea how to get that Max number into the second table. Is this even possible?
I think I got it. I did a CountDistinct on the field the other table was grouped on, and that gave me the correct number.