Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

[Expression.Error] We cannot convert the value null to type Logical.

Hi All...   I've read through a few similar threads but didn't find a solution to my problem. Hoping someone can assist. I'm using the following code in Power Query to assign a fiscal year (FY...
  • Anonymous's avatar
    Anonymous
    5 years ago

    null values can trip you up when used in if statements, and also with equality operators. I would try:

     

    each if [startdate] = null then "" else if [enddate] = null then "" else if [active] = "1" and [live] = "1" and [latest] = "Green" and [startdate] > #date(2020,3,31) and [enddate] < #date(2021,4,1) then "FY21" else ""

     

    --Nate