3 Replies Latest reply on Sep 16, 2013 11:30 PM by Vladislav Grigorov

    Calculated field that will AVERAGE for some time periods, and SUM for others

    Louis Keating

      Hey  guys,

       

      How can I make a calculated field that will AVERAGE for some time periods, and SUM for another?

       

      I'm trying to show 3 different metrics on the same bar chart. I want to compare the current month with the last 5 months.

       

      I've made a calculated Date Field like this:

       

      "IF[Date]< DATETRUNC("month",Today() ) AND

      [Date] >= DATEADD("month",-1,DATETRUNC("month",Today() )) THEN

      "This Month" ELSE

      "Average"

      END"

       

      I've got the comparison, but as you can see, it is summing for both the average and the current period.

       

      Picture below.

       

      Bar Chart - Comparison.png

       

      Thanks all!

       

      Lucas