5 Replies Latest reply: Sep 12, 2018 5:16 PM by Vishwarath Nagaraju RSS

    Sum Amount when Date equals to SalesDate

    Wanyun Yang

      I have two tables in the script: Calendar table with field Date, Sales table with fields SalesDate and Amount. I cannot rename and link the two date fields which will ruin the model.

       

      I want to sum Amount when Date equals to SalesDate. My function now is:

      Sum(Aggr(If(Date= SalesDate, sum(Amount), 0), Date, SalesDate))

       

      This works. And my question is: how can I write an expression with set analysis? Something like:

      Sum({<Date=SalesDate>}Amount)

       

      Thanks in advance!