Jamie
Jamie

Reputation: 43

How to add a "Date" where clause in an expression?

I have a basic question as I am new to qlikview. I have the following expression which works.

=num((SUM({$<[SL Level]={'Test'}>}acceptable)/
(
SUM({$<[SL Level]={'Test'}>}callsoffered )
-SUM({$<[SL Level]={'Test'}>}outflowcalls)
-SUM({$<[SL Level]={'Test'}>}dequecalls)
-SUM({$<[SL Level]={'Test'}>}abncalls1)
-SUM({$<[SL Level]={'Test'}>}abncalls2)
-SUM({$<[SL Level]={'Test'}>}abncalls3)
-SUM({$<[SL Level]={'Test'}>}abncalls4)
)),'#.%')

I would to only return the result of the expression for Today()-1. Any suggestions on the syntax to retrieve the desired result?

Upvotes: 0

Views: 139

Answers (1)

EldadT
EldadT

Reputation: 932

if your date field is Date then the following expression should work:

    num(
        SUM({$<[SL Level]={'Test'},Date={$(=today()-1)}>}acceptable) /
        SUM({$<[SL Level]={'Test'},Date={$(=today()-1)}>} rangesum(callsoffered,-outflowcalls,-dequecalls,-abncalls1,-abncalls2,-abncalls3,-abncalls4))
,'#.%')

or even shorter:

num(
    SUM({$<
    [SL Level]={'Test'},
    Date={$(=today()-1)}>}
    acceptable / 
    rangesum(callsoffered,-outflowcalls,-dequecalls,-abncalls1,-abncalls2,-abncalls3,-abncalls4)
    )
,'#.%')

Upvotes: 3

Related Questions