Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - General Discussion
Answered

Power automate if expression returns error

(0) ShareShare
ReportReport
Posted on by 8
Hi,

I have a cloud flow that gets triggered on schedule and the I run a query against a Power BI dataset to get some data. I use those data to create an html table.
I am using a select action to create an array out of the Power BI dataset retrieved. On the select value I have an expression before the Power BI item that adds a string as a prefix on the value in case a condition is met.
In order to make my life easier I have created a column in the BI dataset that checks the condition and returns true or false. So, in the select I write this expression if(item()?['BIdataset[Flag]'], 'AddString', '') and then the item from power bi. This was working for over a year until 3 weeks ago when I started getting a specific error.
On the select action I get the following error "'The template language function 'if' expects its first parameter to be of type boolean. The provided value is of type 'Null'". Sometimes re running the flow ad hoc solves the problem but other times I have to rewrite the expressions. I know for a fact that the column Flag has always one out of the two values True or False.
 
Also, when I open the failed flow run on the inputs there is not a single instance that the Flag field gets a null value.
 
Does anyone have any idea why is this happening?
 
Am I missing something in my flow?
Categories:
  • Verified answer
    David_MA Profile Picture
    11,713 Super User 2025 Season 1 on at
    Power automate if expression returns error
    Change your expression to a coalesce expression. It is designed to handle null values and returns the first non-null value from the expression. You would update your expression to coalesce(if(item()?['BIdataset[Flag]'], 'AddString', ''), null) 
     
    Do not type null, but choose the null function from the expression builder. And of course, you can replace null with some other value when the value is empty as well. Just put it in single quotes. For example, coalesce(if(item()?['BIdataset[Flag]'], 'AddString', ''), 'not set') instead.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1