web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Cannot convert a value...
Power Automate
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.

Categories:
I have the same question (0)
  • Verified answer
    siwfy Profile Picture
    Microsoft Employee on at

    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.

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @siwfy ,

     

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

     

    Best regards,

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 252 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 169

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard