Subtracting Dates in SAP WebI to return in decimal value

An unconventional requirement has been given to me on subtracting date time in Web Intelligence and return the value as a number with decimals. This simply can be achieved in Microsoft Excel by taking the column F – column E and format the particular column as Number as shown below.

17feb2016

In order to achieve the similar result in WebI, it requires some workaround including converting date and timestamp into hours before subtraction takes place.

Using the same example above, firstly use DaysBetween() formula to find out the number of days between Date A and Date B, then convert the value into seconds before the subtraction takes place.

=((DaysBetween([Date A];[Date B]) * 86400
+(ToNumber(FormatDate([Date B] ;”HH”)) * 3600 + ToNumber(Left(FormatDate([Date B] ;”mm:ss”) ;2)) * 60 + ToNumber(FormatDate([Date B] ;”ss”))))
-(ToNumber(FormatDate([Date A] ;”HH”)) * 3600 + ToNumber(Left(FormatDate([Date A] ;”mm:ss”) ;2)) * 60 + ToNumber(FormatDate([Date A] ;”ss”))))/86400

You can copy this formula and replace the date A and B variables, you should be able to get the result you desire should you have the similar requirement. Thanks for reading!

 

Business days between two dates in SAP WebI

I have seen this question been lurking around forums and coincidentally I received a similar requirement to calculate multiple transactions based on business days by excluding weekends only. Please note that, this will not work if you have public holidays in between.

Read More »

RelativeDate in SAP Web Intelligence

Recently, I have been given a requirement to convert date time from a standard application server time to users local time with a difference of few hours. Needless to say, I was a looking for a standard function that allows me to perform this calculation in a simplest form ever.

Fortunately Web Intelligence provides a function to allow us to do this, you can look up for RelativeDate() function.

Read More »