cancel
Showing results for 
Search instead for 
Did you mean: 

How to find difference without previous

former_member225386
Participant
0 Kudos

Hi All,

I need your help to resolve the below error will using previous function in group level.

ValuelogDifference using Previous
A1B1
A2B2B1-B2
A3B3B2-B3
A4B4B3-B4
A5B5B4-B5
A6B6B5-B6
A7B7B6-B7
A8B8B7-B8
need to find stddev

In the above table those are in black has been done and the red one need to be done.

This table is based on group level while I'm using the stddev for the Difference using Previous column I'm getting an error THIS FIELD CANNOT BE SUMMARIZED.

Could you please help me out that whether is there any way to find difference without using previous or next function.

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Ramesh,

The stddev() function also accepts an array of numbers.

Try this:

1) Create a formula with this code and place it on the section beside the 'Difference using previous' column:

WhilePrintingRecords;

NumberVar array arr;

numbervar i;

i := i + 1;

redim preserve arr[i];

arr[i] := previous({Log}) - {Log};

"";

2) Create another formula and place this on the Footer:

WhilePrintingRecords;

NumberVar array arr;

Stddev(arr);


3) If you need to reset the array for each group, just create a reset formula with this code and place it on the Group Header:


WhilePrintingRecords;

NumberVar array arr := 0;


-Abhilash


former_member225386
Participant
0 Kudos

Hi Abhilash,

Thank you!

Again im facing one problem the stddev returing only right values for first group. from secound group onwords the values of stddev is returning wrong value.

for an cross check could you please let me know the exact position to place the reset formula in report.

abhilash_kumar
Active Contributor
0 Kudos

Hi Ramesh,

The third formula above should be placed on the Group Header #1.

-Abhilash

former_member225386
Participant
0 Kudos

Hi Abhilash,

Thank you!

Done the same and confussed to see that the reset formula specifed below is not reseting the values in group level.

To confirm that I tried to print the "i" values used in Difference formula the value of the "i" is continuing even after the group changed.

WhilePrintingRecords;

NumberVar array arr := 0;

Please help me out in this.

Regards,

Ramesh Jothimani

abhilash_kumar
Active Contributor
0 Kudos

I'm sorry, you also need to reset 'i';

WhilePrintingRecords;

NumberVar array arr := 0;

numbervar i := 0;


-Abhilash

former_member225386
Participant
0 Kudos

Hi Abhilash,

Will this formula calculate stddev based on group level?

WhilePrintingRecords;

NumberVar array arr;

Stddev(arr);

As per my report it is of returing the Standard deviation values for entire values of difference(without considering group level).

Thanks!

Regards,

Ramesh Jothimani

abhilash_kumar
Active Contributor
0 Kudos

What do you mean by group level?

The formula evaluates on the details section and hence looks at 'difference' at each row. The Stddev is printed at the Group level by taking into account all differences for that group.

Could you post a screenshot of what you're trying to do and how the report is structured?

-Abhilash

former_member225386
Participant
0 Kudos

Hi Abhilash,

Thank you for your quick responce.

Please find the attachment of the expected outcome and report structure.

abhilash_kumar
Active Contributor
0 Kudos

Ok, see if this helps:

Modify the first formula above to:

WhilePrintingRecords;

Numbervar x := x + 1;

NumberVar array arr;

numbervar i;

If x <> 1 then

(

     i := i + 1;

     redim preserve arr[i];

     arr[i] := previous({Log}) - {Log};

     "";

);


Modify the reset formula on the Group Header to:


WhilePrintingRecords;

NumberVar array arr := 0;

Numbervar x := 0;

Numbervar i := 0;


-Abhilash

former_member225386
Participant
0 Kudos

Hi Abhilash

Sorry for the late reply I were OOO.

Its workign fine thanks a lot for you help.

former_member225386
Participant
0 Kudos

Hi Abhilash,

Again now im getting an new error while im selecting more than 52 weeks in the prompt.

Could you please help me on this.

abhilash_kumar
Active Contributor
0 Kudos

Please close this thread and post this new issue as a separate discussion per SCN's rules.

Also post a screenshot of the full formula editor window with the panel on the left expanded.

-Abhilash

Answers (0)