Within my crystal report details section i have several values from the field amount, i added a simple formula field to my group header to calculate the SUM({Amount}) Which works however i only want it to SUM the positive values.
There is always a negative version of the positive.
Data
10
30
60
-10
-30
-60
Current Output with SUM({Amount})
0
Desired Output
100
Something like but in crystal variant
SUM({Amount}) FROM mytable WHERE {Amount} > 0
You can use two formula to fulfill ur requrement
1.#Positive_Number
if{Table.amount} > 0 then {Table.amount} else 0
2.#Sum_of_PositiveNumber
Sum ({#positive_Number})
thanks
Ankur
Another option would be a running total that sums the {Table.amount} and evaluates on a formula. {Table.amount} > 0
reset on group if your report is grouped
What i did was create a new parameter called ABSAmount :
ABS({AMOUNT})
Then another
SUM({#ABSamount})/2
This gave me the required output.
Related
I have a report (Pivot table) for which I have a value everyday. My goal is to calculate the variance every day and highlight with conditional styles.
1 jan. 23
2 jan. 23
3 jan. 23
5
25
42
I have a query who calculates the variance between days in % (which I dont want to put in the report).
My conditional style rule is [Table].[Pourcentage variation D-1] between 0,05 and 10.
Since my request is not in displayed my report, I have this error :
RSV-VAL-0032 The following expression is not valid. If the item exists
in a query but is not referenced in the layout, add it to a property
list.
The problem is that I don't have the "Proprety list" in my pivot table like in can have in a Data table.
How can I highlight my variance based on a request that I dont display in my Pivot table ?
Thanks for helping
Add the calculated field to the pivot table (I know you do not want this in the layout, this is just to test if that removes the error). See if the conditional style works the way you expect.
If so, change the column for the percentage data item to property, set box type to none. This way it is still something that can be referred to, but is hidden from the final result
I have a column in SAP BO WEBI. For example, I have the following values in my column.
MONTH
0
0
2
4
3
When I try the Min() function in WEBI like this Min([MONTH]),
it returns 0 for me. But I want the value 2 to come. So I want to return the non-zero minimum value. How can I do that?
Thanks.
In WebI this should do it...
=Min([Month]) Where ([Month] > 0)
Here is what it looks like with data from the eFashion universe.
In SSRS, I have written a dynamic sql in which a column is populated from a case statement. The sql query is correctly populating the column in sql result but when I use it in a tablix for creating a group and summing it by 'X' column as shown below. It does not populate at all. Rest of tablix is populating fine. Can somebody please help.
eg: The columns generated by SQL has below result. Bucket is generated by case statement. In tablix I want the first row to be grouped by Bucket and in next row sum by the x column
> **X** **Bucket**
> 0 NULL
> 1 Today
> 1 1-10
> 1 11-20
> 0 NULL
> 1 1-10
> 1 Today
> 1 20-30
Expected Result
> Today 1-10 11-20 20-30
> 2 2 1 1
Set your column grouping expression to Bucket and the detail row will simply have an expression like =SUM(Fields!X.Value).
You don't need any row grouping
I am making a report using Crystal report. My column data(Amount) is grouped according to id(1 and 2). I want to print difference of total sum of amount according to id(1 and 2).
For eg:-
In group id 1, amount field are:-
100
200
300
And in group id 2 amount fileds are:-
50
150
250
My output in crystal report should be: 1-2
i.e: (100+200+300) - (50+150+250)
Please help me. I have tried doing it through formula field in this way:-
local numbervar x=0;
if({Statement_of_Pay.Pay_Head_Type_Code}=1)
then
x:= x + {Statement_of_Pay.Amount}
else if({Statement_of_Pay.Pay_Head_Type_Code}=2)
then
x:= x - {Statement_of_Pay.Amount}
This is not working the way I want.
Kindly help me!
For summation you can use the sum option in crystal reports instead of writing a formula as you did.
Below solution works assuming group ID 1,2 are the results of the same group not 2 groups.
Take the sum of the column by going to Right Click ---> Insert Summary and insert summary to the level you required.
Create a formula #Group1
whileprintingrecords;
Shared NumberVar Storegroup1;
if(GroupNumber=1)
then
Storegroup1:=sum({databasefield},{groupid});
Create a formula #Group2
whileprintingrecords;
Shared NumberVar Storegroup2;
if(GroupNumber=2)
then
Storegroup1:=sum({databasefield},{groupid});
now take the difference in the section you require. Create a formula #Display
EvaluateAfter(#Group1);
EvaluateAfter(#Group2);
Shared NumberVar Storegroup1;
Shared NumberVar Storegroup2;
Storegroup1-Storegroup2;
I need to filter the measure values as
MeasureA MeasureB
10 10
15 15
5 20
20 20
Here I need to get only the measures are not equal, I am using filter function as but not working
Select Filter({[Measures].[A],
[Measures].[B]},
([Measures].[A]-
[Measures].[B])=0)
on 0
from [Cube]
Expected result set
MeasureA MeasureB
5 20
What am I missing?
Try using a dimension instead of your measures for the first part of the filter statement. Assuming you are querying products then your query might look like:
select {[Measures].[A],[Measures].[B]} on columns,
filter ({[Products].Members},[Measures].[A] = [Measures].[B]) on rows
from [Sales Cube]
You might want to try creating a calculated field in the DSV for this Fact table...
CASE
WHEN MeasureFieldA != MeasureFieldB THEN 1
ELSE 0
END
Then you can create a "fact dimension" and have this calculated field as an attribute to be used in your queries or calculated measures.