1 Reply Latest reply on Oct 29, 2013 10:37 AM by Tracy Rodgers

    Calculating measures using dates

    Siddharth Surana



      For some reason I am stuck.


      I have to calculate a simple measure based on the date


      For eg. I have a measure field say [Sales] and a date field with the dates 6/5/2012 12:00:01 Am and 6/6/2012 12:00:01 Am.


      I'd like my calculated field to look like this: (Sales of (6/5/2012) * 75%) + Sales of (6/6/2012) *25%)


      So basically the ability to add 75% of today'sales and 25% of the  next day's sales.


      All my data is updated daily once.


      If anyone has any suggestions, would be really appreciated




        • 1. Re: Calculating measures using dates
          Tracy Rodgers

          Hi Sid,


          Sorry for the delay in receiving a response! Do you still need assistance with this?


          This could be done in a couple of ways. One way would be to create a calculated field similar to


          (if [Date]=# 6/5/2012 12:00:01# then sum(Sales)*.75 end) + (if [Date]=# 6/6/2012 12:00:01# then sum(Sales)*.25 end)


          Another option would be to create a calculated field that uses the lookup function:


          lookup(sum(Sales), -1)*.75 + (lookup(sum(Sales), 0)*.25)


          Hope this helps!