如何在表达式中添加“Date”where子句?

时间:2018-03-22 17:51:02

标签: qlikview

我有一个基本的问题,因为我是qlikview的新手。我有以下表达式。

=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)
)),'#.%')

我只会返回Today() - 1表达式的结果。有关检索所需结果的语法的任何建议吗?

1 个答案:

答案 0 :(得分:3)

如果您的日期字段为Date,则以下表达式应该有效:

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

甚至更短:

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