Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Cannot convert a value from Kusto Query to integer

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all, I have run into this strange issue where I cannot convert Kusto query results into integers with combo of expression and Data Operation in Power Automate. 

First, I wrote this Kusto Query:

Cluster URL: https://hwinventory.kusto.windows.net/

Database: hwinventory

Query: 

Dbd
| where ExpectedBinId startswith "ZQZ24"
| where State == "WaitingDestruction"
| summarize Age = now() - min(CreatedTime)
| project Age = toint(format_timespan(Age,"d"))
| project Age = iif(isempty(Age), 0, toint(Age))
 
And then I added another step: Data Operation → Compose, using formula "int" in the Expression to compose the result of the query above. To clarify it, I could not use the query results in the flow directly, which is why I had to compose them.
siwfy_0-1660360805508.png

 

When I run the flow, I would always get this error message saying that:

Action 'Convert_Bin_Age_of_ZQZ22_to_Integer' failed.

Unable to process template language expressions in action 'Convert_Bin_Age_of_ZQZ22_to_Integer' inputs at line '0' and column '0': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.

 

I also tried changing the last line of my Kusto query to: 

| project Age = iif(isempty(Age), "0", tostring(Age))

 

but I got the same error message. I am pretty sure my query is fine because it runs okay in Azure Data Explorer.

 

I could not for the life of me figure out what went wrong. I believe I composed my steps correctly and start to wonder there's something wrong with Power Automate. Would highly appreciate it if somebody can help me out here.

  • v-jefferni Profile Picture
    on at
    Re: Cannot convert a value from Kusto Query to integer

    Hi @siwfy ,

     

    Please consider accept you reply as solution so other uses will be able to find it quickly.

     

    Best regards,

     

     

  • Verified answer
    siwfy Profile Picture
    Microsoft Employee on at
    Re: Cannot convert a value from Kusto Query to integer

    Seems the issue was caused by the feature that when query results are composed in the flow, they come with the title. What I need to do is use split formula to extract the number from the query result first and then convert it to an integer. Simple as that.

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May 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 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492