Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Blank rows resulting into error for If Then and Else statement

Hello,

Could someone please advise as I keep getting error for blank rows (column heading shows a Red underline whereas other formula containing column heading show green underline)

 

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

 

I am using a formula as below

 

if [Status] <> "" and [Close date] < #"Period Start" or #"Period End" < [Open date] then "Hide" else "Show"

 

It was working fine in tableau but in power bi may be I am missing something to fix the problem for cells containing null values.

 

Status column for each row either contains Active or Not active

 

Appreciate any guidance to fix the if else error.

thanks

 

 

5 REPLIES 5
Anonymous
Not applicable

@dharmendars007 @Anonymous 

I am looking to evaluate the existing column Close date with the parameter Period start. In tableau, you can use columns + parameters in the formula and execute the calculations such as in this case the count the tasks completion using number of "show" rows..

Thanks

Anonymous
Not applicable

hi - @Anonymous 

Thanks for reply with detailed steps, please note that the words "Period Start" are actually parameters that I have created to define the start of the period and likewise "Period End" for end of the period.

I am still having the below error 

Column 'Period Start' cannot be found or may not be used in this expression.

dharmendars007
Super User
Super User

Hello @Anonymous , 

 

Please find the modified logic to hendle the status column is null or blank..

 

IF(
NOT(ISBLANK([Status])) &&
NOT(ISBLANK([Close date])) &&
([Close date] < #"Period Start" || #"Period End" < [Open date]),"Hide","Show")

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

Anonymous
Not applicable

Hi @dharmendars007 

Thanks,I am getting this error when trying to type the parameter names such as #'Period start' above.

Error: The following syntax error occurred during parsing: Invalid token, Line 1, Offset 107, #.

 

how do I get the parameters in this calculated column?

Anonymous
Not applicable

Thanks for the reply from dharmendars007.

 

Hi @Anonymous ,

 

The error is shown in the following image:

vlinhuizhmsft_0-1727343873001.png

 

In your formula, using the # symbol can lead to syntax errors. You can refer to these column names directly using  [    ]:

 

column = IF(
NOT(ISBLANK([Status])) &&
NOT(ISBLANK([Close date])) &&
([Close date] < [Period Start] || [Period End] < [Open date]),"Hide","Show")

 

 

vlinhuizhmsft_1-1727343951782.png

 

You can follow the link below to learn:DAX syntax - DAX | Microsoft Learn

 

Best Regards,
Zhu
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors