Skip to main content

Hello,

 

Can you please improvise this calculation? I am not sure why the output is giving me * as well.

 

IF DATEDIFF('day', TODAY(), [End Of Life Date]) > 180 

THEN "Greater than 180 days"

ELSEIF [End Of Life Date] >=TODAY() AND DATEDIFF('day',TODAY(),[End Of Life Date]) <=180 

THEN "Next 180 days"

ELSEIF [End Of Life Date]<=TODAY() and DATEDIFF('day', [End Of Life Date],{ EXCLUDE [End Of Life Date] : Min([End Of Life Date])}) < 1 

THEN "In Past days"

ELSE "No End of Life"

END

 

TIA

 

Regards,

Nipa Madhani

9 answers
  1. May 19, 2023, 12:05 PM

    thanks for providing your twbx -

    you have nulls in the End of life date field that are creating the issue

    this is one way to address them - but I don;t know that the logic will return what you want

    see the red tabs

     

    IF ISNULL(lookup(ATTR([End Of Life Date]),0)) then "No End of Life"

    elseIF DATEDIFF('day', TODAY(), min([End Of Life Date])) > 180 

    THEN "Greater than 180 days"

    ELSEIF min([End Of Life Date]) >=TODAY() AND DATEDIFF('day',TODAY(),min([End Of Life Date])) <=180 

    THEN "Next 180 days"

    ELSEIF min([End Of Life Date])<=TODAY() and DATEDIFF('day', min([End Of Life Date]),min({ EXCLUDE [End Of Life Date] : Min([End Of Life Date])})) < 1 

    THEN "In Past days"

    ELSE "No End of Life"

    END

    Thanks

    Jim - Tableau Visionary

0/9000