Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

matheus_silva
Contributor

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...

Capturar.JPG

Someone can help me?

1 Solution

Accepted Solutions

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))

5 Replies

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.

Life is so rich, and we need to respect to the life !!!

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))

yoganantha321
Contributor II

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

matheus_silva
Contributor

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!!!