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

Community site session details

Session Id :
Power Automate - Using Flows
Suggested answer

Comparing values

(0) ShareShare
ReportReport
Posted on by Microsoft Employee
I am performing a kusto query to obtain data from one source and an ADO query to get data from a different source.  I want to compare the idnumber from the Kusto query to make sure there are no duplicates in the ADO data. What would be the best way to do that? I've tried using arrays but it doesn't seem to be working. Any ideas?
I have the same question (0)
  • Suggested answer
    Garima_PowerPlatform Profile Picture
    170 on at
    Comparing values

    Hi

    1. Retrieve Data from Kusto and ADO Queries

    Kusto Query

    • Perform a Kusto query to extract the idnumber values.

      KustoQuery | project idnumber

    ADO Query

    • Use ADO REST API to get data and extract the idnumber values.

      json
      
      GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems?api-version=6.0

    2. Extract Unique idnumbers

    • After fetching the data from both sources, extract the idnumber into arrays.

    Kusto Extraction

    YourKustoQuery | project idnumber

    ADO Extraction

    json
    [
    {
    "id": 1,
    "fields": {
    "idnumber": "123"
    }
    },
    {
    "id": 2,
    "fields": {
    "idnumber": "456"
    }
    }
    ]

    3. Compare for Duplicates

    • Compare the idnumber arrays using Power Automate.

    Using Power Automate:

    1. Extract idnumber from Kusto:

       
      YourKustoQuery | project idnumber
    2. Extract idnumber from ADO:

      Json
       
      [
      {
      "fields": {
      "idnumber": "123"
      }
      },
      {
      "fields": {
      "idnumber": "456"
      }
      }
      ]
    3. Use Apply to Each:

      • Use Apply to Each to iterate through each idnumber from the Kusto query and check if it exists in the ADO results.

    4. Compare for Duplicates:

       
      kusto
       
      union (KustoIdNumbers)
      intersect (ADOIdNumbers)

    This will output common idnumbers between Kusto and ADO.

  • astockli Profile Picture
    Microsoft Employee on at
    Comparing values
    @Garima_PowerPlatform​​​​​​​ How are you doing this in Power Automate?
  • Suggested answer
    Garima_PowerPlatform Profile Picture
    170 on at
    Comparing values
    Hi there are different ways to achieve this functionality if you are looking for Power Automate here are steps:

    Use Power Automate if the process needs automation within Microsoft's ecosystem.
    Use Kusto for query-based comparison if data can be integrated.
    Use Python or PowerShell for more control and flexibility in processing.
     

    Power Automate Flow to Compare idnumber

    1. Trigger the Flow

    Choose a suitable trigger, such as:

    • A button in Power Apps.
    • Scheduled flow.
    • HTTP request trigger (if called programmatically).

    2. Retrieve Data

    1. Run the Kusto Query:

      • Use the "Run Query and List Results" action from the Azure Data Explorer connector.
      • Parse the results to extract the idnumber values into an array:
         
        json
         
        [
        { "idnumber": "123" },
        { "idnumber": "456" },
        { "idnumber": "789" }
        ]
    2. Query ADO Data:

      • Use the HTTP with Azure DevOps connector or the "Send an HTTP request" action.
      • Query the ADO API to get work item details.
      • Parse the response to extract the idnumber values:
         
        json
         
        [
        { "idnumber": "123" },
        { "idnumber": "999" }
        ]

    3. Compare the Arrays

    1. Initialize Two Variables:

      • KustoIDs: Store the idnumber array from the Kusto query.
      • ADOIDs: Store the idnumber array from the ADO query.
    2. Apply to Each Loop (Iterate over Kusto IDs):

      • Add an "Apply to Each" action.
      • Use the KustoIDs array as the input.
    3. Condition to Check for Duplicates:

      • Inside the loop, add a Condition action:
        • Condition: Check if the current idnumber from KustoIDs exists in ADOIDs.
        • Expression:
          contains(variables('ADOIDs'), items('Apply_to_each'))
    4. Handle Duplicate Matches:

      • If Yes (duplicate found):
        • Append the duplicate to a new array (e.g., DuplicateIDs).
      • If No: Do nothing.

        Quick overview

         
      • Trigger: Manual, Scheduled, or Power Apps.
      • Query Kusto: "Run Query and List Results" (Azure Data Explorer).
      • Query ADO: Use "Send an HTTP Request" or "List Work Items" (Azure DevOps).
      • Initialize Variables: For KustoIDs and ADOIDs.
      • Apply to Each: Iterate over KustoIDs.
      • Condition: Check if current idnumber exists in ADOIDs.
      • Action: Append duplicates to DuplicateIDs array.
      • Output: Log, send, or return duplicate results.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 722 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 461 Moderator

#3
developerAJ Profile Picture

developerAJ 283

Last 30 days Overall leaderboard

Featured topics

Restore a deleted flow