SAP Knowledge Base Article - Public

3232497 - CMT : CPQ: How to write a tag that will compare two dates


CPQ: How to write a tag that will compare two dates


Applies To:  



This article will show you how to write a CPQ tag that will compare two dates within CPQ.

Currently, CPQ does not have tag operator to compare two dates. Using operator tags such as [GT] (Greater Than) or [LT] (Less Than) will only compare number and string values; therefore, will not work for dates.


The best optimal way to compare two dates in CPQ is to use a VBScript function, DateDiff, in a CPQ Eval Tag.

Correct tag to use is below:



Return results of tag would be:

Positive Number = Number of day(s) from "Date1" to "Date2".

Negative Number= Number of day(s) after "Date1" to "Date2".

0 = Same dates are being compared.

Sample of what tag should look like:
E.g <*Eval(DateDiff("d","05/04/2014","04/04/2015"))*>



  • The 'DateDiff' is Visual Basic Function. Click here to find more information about this function.
  • VB Function must be used inside of a CPQ Eval (<* Eval(...) *>) tag.



KBA , CEC-SAL-CPQ , Sales Cloud CPQ , How To


SAP CPQ all versions