0 Replies Latest reply: Apr 26, 2012 8:41 AM by Marcus Jirak RSS

    Weird results with interleaved if-clauses

      Hi!
      We just found out that the following formula delivers wrong results:
      sum     (
                if     (     [EINDEUTIGER MONAT] = MonthStart(today()), 
                          if     (     AUFTRAGSART='14',
                                    RECH_NETTO_UMSATZ,
                                         if     (     isnull(LIEF_NETTO_UMSATZ_VAHK),
                                              0,
                                              LIEF_NETTO_UMSATZ_VAHK
                                         ) 
                                    + 
                                    if     (     left(RECHNUNGSNR,2)='GS',
                                              RECH_NETTO_UMSATZ,
                                              0
                                         )
                               ),
                                RECH_NETTO_UMSATZ)
           )
      
      What this formula basically does is summarize RECH_NETTO_UMSATZ. The outer if-clause differs between the current month and all past months, the inner if-clause differs between different kinds of customers. So generally speaking, for all past months, the formula should be cut down to a simple sum (RECH_NETTO_UMSATZ), shoudn't it? Well, it doesn't.
      If we simply use sum(XY) we get different results than if we use sum ( if (clause1 = FALSE,XY,0). We have no idea, why.