Skip to Content
0
Mar 15, 2013 at 01:42 PM

MonthsBetween changes

50 Views

According to SAP Note 1270874, the behavior of MonthsBetween in WebI is changing in XI3.1 SP5.4, SP6, and BI4 SP04.

I did some testing of this change in SP5.4, and while it does fix an inaccurate calculation when one or both of the dates are end-of-month, it breaks the behavior with start-of-month or mid month dates are used.

For example MonthsBetwween 10/31/2012 and 11/30/12 was 0 in SP4, but is now 1. This makes sense to me.

Date 1Date 2SP4SP5.4 10/31/1211/30/1201

But the MonthsBetween 11/1/12 and 12/1/12 has changed from 1 to 0:

Date 1Date 2SP4SP5.411/1/1212/1/121011/1/121/1/132111/1/122/1/133311/1/123/1/134311/1/124/1/135511/1/125/1/1365

Note that we get two End months with a MonthsBetween value of 3, and again for 5. It's not displayed above, but SP5 produces a value of 4 when the Date 2 is 3/2/13 to 3/31/13.

And things get wacky in February:

Date 1Date 2SP4SP5.42/16/133/16/13102/16/133/17/13102/16/133/18/13102/16/134/16/13212/16/134/17/1321

A value of 0 for MonthsBetween 2/16/13 and 3/18/13 doesn't make sense to me.

Does anyone else agree that the new logic is not an improvement?