5 Replies Latest reply: Apr 3, 2017 2:48 PM by Matheus Colares

# Sum between date

Hi,

I need sum a values between two data, but this date don't  have any relationship.

In my dimension a have a package, and this package have a initial date and final date, so a have other table witch have a date and a values, i have tried did something like:

SUM({\$< AP_DATA_VMD = {">= \$(=AP_AGEN_PAI_DTINI <=\$(=AP_AGEN_PAI_DTINI"}>} AP_VAL_VMD)

But not work...

Someone can help me?

• ###### Re: Sum between date

You don't have the relation between AP_DATA_VMD and AP_AGEN_PAI_DTINI dates rite

Push the start and end date values to a variable and use the same you will get results

SUM({\$< AP_DATA_VMD = {">= '\$(vStart)'<='\$(vEnd)'}>} AP_VAL_VMD)

vStart

=min(AP_DATA_VMD ) // change according to your requirement

vEnd

=max(AP_DATA_VMD )

• ###### Re: Sum between date

May be try this?

Sum(AP_DATA_VMD+AP_AGEN_PAI_DTINI)

Or

Sum(Num(AP_DATA_VMD)+Num(AP_AGEN_PAI_DTINI))

Or finally, may be this

SUM({\$< AP_DATA_VMD = {">= '\$(vStart)'<='\$(vEnd)'}>} AP_VAL_VMD)// vStart is may be min and similar to max.

• ###### Re: Sum between date

May be using Aggr()

Sum(Aggr(If(AP_DATA_VMD >= AP_AGEN_PAI_DTINI and AP_DATA_VMD <= AP_AGEN_PAI_DTINI, AP_VAL_VMD), YourCharDimensionsHere))

• ###### Re: Sum between date

hi Silva,

May be this will be useful

Date#([field1], 'MM/DD/YYYY') > 0,Today() +Date#([field2], 'MM/DD/YYYY') as field

• ###### Re: Sum between date

Thanks everyone for help,

But the problem was in my script, because i used "Concatenate". I fixed my script and  the Sunny code it worked...

I wanted use set analysis, but the date need be a variable, and my date is dynamics...

Thanks again community!!!