Showing results for 
Search instead for 
Did you mean: 

To calculate the number of days between two dates for each query record

Former Member
0 Kudos

Just wondering if I can get some help in the following:

I have the requirement to calculate the number of days between two dates. The request is to run this calculation for each record from the query.

I started to investigate how to do this using Virtual Characteristics and Virtual Key Figures. I have created the cube in which I have two Characteristic dates as sources (0CLEAR_DATE and 0NETDUEDATE) and the target as a Key Figure (0NUMDAY), with the aim to use the 0NUMDAY as Virtual Key Figure.

My question is which BAdi to use for this and how to implement this successfully? Thank you.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

1. define a formula.

2. in the formula, define two Replacement Path variable. variable1 is about 0CLEAR_DATE, variable2 is about 0NETDUEDATE.

3. formula = variable1 - variable2, so you don't need the keyfigure in your cube.

Former Member
0 Kudos

Hi Sorin,

You can try variable with replacement path , In your scenario you will have to have 2 variables 1 for clear date and one for net due date.

After that create formula of subtraction on this two variables .

This will give you diff. between two dates.



Active Contributor
0 Kudos


Welcome to SDN...

since you have all the infoobjects in the cube - why dont you calculate the number of days during data load instead of doing it at the front end?

There are standard function modules available to chaieve the same during data load and you need not use anything specific at the query level...


Hope it helps...

P.S You do not need any BADI to achieve the same...