7 Replies Latest reply on Apr 2, 2018 2:14 AM by Yuriy Fal

    Aggregate Calc in Fiscal YTD Price Per Unit

    KK Edla

      Hi All,

      . joewright Marc Rueter Joe Mako Jonathan Drummey SMMC

       

      I'm trying to calculate Price Per Unit for all products sold to a Customer by Month (showing in fiscal year) when a user selects YTD (In the parameter). The formula is as follows.

       

      IF

      DATEDIFF('year', [Order Date], TODAY())=0

      AND

      DATE([Order Date])< TODAY()

      THEN

      [Price per Unit]

      END

       

      this errors out as expected "Cannot mix aggregate and non-aggregate comparisons or results in 'IF' expressions"

       

      So, I tried this

       

      IF

      ATTR(DATEDIFF('year', [Order Date], TODAY()))=0

      AND

      ATTR(DATE([Order Date]))< TODAY()

      THEN

      [Price per Unit]

      END

       

      This calculation doesn't give errror, but, the results are not showing correct. What am I doing wrong here? Can someone please throw some light?

       

      I'd really appreciate it.

       

      Thanks,

      KK