2 Replies Latest reply on Aug 26, 2016 7:12 AM by Stephen Rizzo

    THEN IFNULL([exp1], [exp2])

    ahmed.hasnaoui

      Hi community,

       

      I just created a calculation where I needed to split budget by year.

      A row has either budget for the year 16 oder 17

      For this I created two measures.

      IF [BYear] == "2016"

      THEN [Budget]

      END

      analogous for 2017.

       

      Now I realized I will get NULL values if there is no measure for '16 resp. '17.

      I then replaced the NULL using the IFNULL() function.

       

      IF [BYear] == "2016"

      THEN IFNULL([Budget], 0)

      END

      I had to adjust the condition:

       

      IF [Budget Year] == "2016" AND NOT ISNULL([Budget])

      THEN [Budget]

      ELSE 0

      END

      Why doesn't the first calculation, where I put the IFNULL() function in the THEN branch work? It fires no error...for me its logically also correct.

       

      Bug or feature?