New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor III

Set analysis: sum if date before today

Hello everyone,

I'm trying to create a misure based on the current date. I'd like to sum the differences between two dates, based on the finish date that must be not after today.

So, I'd like to achieve something like:

SUM({<FinishDate <= {Today()}>}               INTERVAL(Finishdate - StartDate, 'd'))

Obviously the formula is wrong, how could I achieve that?

Many thanks

1 Solution

Accepted Solutions
Honored Contributor II

Re: Set analysis: sum if date before today

SUM({<FinishDate = {"<=\$(=Today())"}>}              INTERVAL(Finishdate - StartDate, 'd'))

4 Replies
Esteemed Contributor

Re: Set analysis: sum if date before today

Just create a table:

as dimension:

StartDate

as measure:

today(1)-StartDate

or maybe:

if(FinishDate>today(1),today(1)-StartDate,FinishDate-StartDate)

example:

Honored Contributor II

Re: Set analysis: sum if date before today

SUM({<FinishDate = {"<=\$(=Today())"}>}              INTERVAL(Finishdate - StartDate, 'd'))

Honored Contributor III

Re: Set analysis: sum if date before today

SUM({<FinishDate = {'<=\$(=Today())'}>}INTERVAL(Finishdate - StartDate, 'd'))

New Contributor III

Re: Set analysis: sum if date before today

That's exactly that I wanted, many thanks!

I guess I have now understood how it works with > and < comparison...!