Skip to Content

This document gives a clear picture on how to remove the negative values which came as difference between two dates in average calculation using SAP Bex Query Designer.

First we are calculating the difference between dates in the run time and if the difference between the dates is +ve then we are considering them in
average calculation.

Business scenario:

While displaying the average of difference between PO Creation Date – PR Release Date based on PO Creation Month, business does not want to consider those records when the difference between these two dates are –ve. It means we need to consider those PO and PR’s only when PO Creation Date is after PR Release Date.

steps:

1) We need to create Formula with replacement path on PR Approval Date and PO Creation Date

SAP SDN - 1.jpgSAP SDN - 2.jpg

SAP SDN - 3.jpgSAP SDN - 4.jpg

2) We have to create formula between PO Creation Date and PR Approval Date with execeptional aggregation of  Average based on PO line Item which is the least granularity

SAP SDN - 5.jpg   SAP SDN - 6.jpg

3) Using above formula, PR Approval Date and PO creation Date we need to create below fomula with execeptional aggregation of  Average taking reference characteristic as PO line Item which is the least granularity. Here we are considering only those records in which PO Cretion Date is greater than PR Approval Date

SAP SDN - 7.jpgSAP SDN - 8.jpg

4)  Using above formula we need to create one formula with execeptional aggregation of  Summation taking refrecne characteritic as PO line Item which is the least granularity

SAP SDN - 9.jpgSAP SDN - 10.jpg

5)  We need to create formula which gives the PO Line item count for those entries which are having PO Creation Date greater than PR Approval Date

SAP SDN - 11.jpgSAP SDN - 12.jpg

6) We need to create formula using PO Creation Date and PR Approval date summation which got in step 4 divided with the PO Line Item count which we got in step 5

SAP SDN - 13.jpg

Apart above formula all the remaining formulas which created upto point 6 are hidden and we are going to display only the formula in point 6 in the query out put.

SAP SDN - 1lost.jpg

7) Example for better understanding

7500204176, 7500202355, 7500201406 PO numbers are taken as example among these three PO 7500204176 and PR 11235821 are having difference between PO Creation Date and PR Approval Date as –1 but it is showing 0 in the report output. This record should not be considered in average calculation when we remove all the display characteristics from ROWs .

SAP SDN - 14.jpg

As per the output below the above record i.e. PO 7500204176 and PR 11235821 which has actually negative value in difference between PO Creation Date and PR Approval Date is not considered and showing only 2 as average.

SAP SDN - 15.jpg

Note : Even though Negative values which came as difference between PO Creation Date and PR Approval date will not be considered
in average calculation but they will be visible and show the difference between them as 0 when we drill down both PO, PR Document numbers and Line items in to the report output.

This document was generated from the following discussion: The specified item was not found.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply