Power Query Expression.Error: We cannot convert the value 100 to type Logical

Michelle Chiaramonte 1 Reputation point
2021-04-20T21:59:44.46+00:00

I have two columns I converted to currency. The blank rows resulted in null which I replaced with 0. For a custom column that should add the two columns, it gives me the following error message:

Expression.Error: We cannot convert the value 100 to type Logical.
Details:
Value=100
Type=Type

My custom column formula is: = Table.AddColumn(#"Changed Type", "2022 Budget", each if [Budget Level Name] = "BOCC Deliberations" or [Position Budget Level Name] = "BOCC Deliberations" then [Total Amount] and [Total Amount3] else [BOCC Deliberations])

what do I need to do to the columns so that it recognizes the values as numbers?

Community Center Not monitored
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Lz._ 9,016 Reputation points
    2021-04-21T05:36:48.683+00:00

    Hi @Michelle Chiaramonte ,

    It's not clear to me what you expect in the new column when neither [Budget Level Name] nor [Position Budget Level Name] = "BOCC Deliberations" so I put 0. In the code you posted you refer to [BOCC Deliberations] in that case but from your description I'm under the impression there's no column named "BOCC Deliberations" in your table (if that column doesn't exist you'll get error: The field 'BOCC Deliberations' of the record wasn't found)

    = Table.AddColumn(#"Changed Type", "2022 Budget", each  
        if ([Budget Level Name] = "BOCC Deliberations") or ([Position Budget Level Name] = "BOCC Deliberations")  
        then [Total Amount] + [Total Amount3]  
        else 0,  
        Currency.Type  
    )  
    

    If you want to display "BOCC Deliberations" instead of 0 just replace the latter with "BOCC Deliberations". If you want something else please explain

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.