Error handling in if function with date RRS feed

  • Question

  • I hope you guy's can help me out with this:

    if [Fälligkeitstage] = 99999 then 
    (#date(Date.Year([Belegdatum]), Date.Month([Belegdatum]) + 1)) else

    The issue is that if the month is december I get an error since there is no 13th month... suprise...

    so I tried to do this

    if [Fälligkeitstage] <> 99999 then 
    Date.AddDays([Belegdatum],[Fälligkeitstage]) else 
    if Date.AddMonth([Belegdatum], 1) = Error then 
    (#date(Date.Year([Belegdatum]), 1, 25)) else 
    (#date(Date.Year([Belegdatum]), Date.Month([Belegdatum]) + 1))

    but that isnt workin either

    Thursday, December 3, 2015 4:32 PM