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 / Copilot Studio / Power Automate prompt ...
Copilot Studio
Suggested Answer

Power Automate prompt miscomparing dates

(0) ShareShare
ReportReport
Posted on by
We are analyzing a json with ids and dates and want to identify the best candidate based on a natural language question.
JSON:
"elements": {
    "58": {
      "dataInicial": "1991-01",
      "dataFinal": "1999-07"
    },
    "655": {
      "dataInicial": "1999-08",
      "dataFinal": "2006-06"
    },
    "1419": {
      "dataInicial": "2012-01",
      "dataFinal": "2019-12"
    },
    "1692": {
      "dataInicial": "1989-07",
      "dataFinal": "1990-12"
    },
    "2938": {
      "dataInicial": "2006-07",
      "dataFinal": "2011-12"
    },
    "6691": {
      "dataInicial": "2014-11",
      "dataFinal": "2026-06"
    },
    "7060": {
      "dataInicial": "2020-01",
      "dataFinal": "2026-06"
    }
  }

We questioned which elements encapsulate the period of 2019 until today and asked for an explanation. In this case, the element 6691 should be chosen, but the agent responds "no element covers the time period" and gives the following explanation:

"6691": "Coverage from 2014-11 to 2026-06, doesn't cover from 2019-01 to 2014-10"

We tried:
- Comparing logically the inicial dates and the final dates separately and to return only when the dates in the question are between the dates in the elements (a more code based approach with intermediate variables with boolean value)
- Using a natural language approach
- Using dates in format YYYYMM and YYYY-MM

What are the best practices when handling dates and comparing numbers with prompts? Is it possible to achieve 100% accuracy in these cases?
I have the same question (0)
  • Suggested answer
    sannavajjala87 Profile Picture
    282 Super User 2026 Season 1 on at
    Hi,
     
    The honest answer to your last question: no, you won't get 100% by having the model compare the dates itself. That weird explanation you got ("doesn't cover from 2019-01 to 2014-10") is the tell. The range is backwards, so the model didn't really compare anything, it just made up text that looks like reasoning. LLMs are bad at this kind of number/date math when it's mixed into a generation task, and prompt tweaking won't fully fix it.

    What works is to stop making the model the calculator. Let it read the question and pull out the target range (2019-01 to today), then do the actual comparison in a Power Automate flow or Power Fx, where the rule is just dataInicial <= start AND dataFinal >= end. Do that and 6691 matches every time, while 7060 (starts 2020-01) correctly drops out.

    Two quick tips: convert the dates to YYYYMM integers before comparing (201901 instead of "2019-01"), and pass in today's date as a variable instead of trusting the model to know it.

    So it's very doable, just not as a pure prompt. Parse with the model, compare in code.
     
  • Suggested answer
    11manish Profile Picture
    2,837 on at
    Do not rely on prompts alone for date comparisons, numeric calculations, or business-critical filtering. Use code, Power Automate, functions, or plugins to
     
    perform the comparison, and use the LLM only to interpret and explain the results.
     
     
  • chiaraalina Profile Picture
    2,318 Super User 2026 Season 1 on at
    Hi
     
    Are you using AI Builder Run a prompt. Please share your flow and your prompt. It's easier to help!

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 249

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 180 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 153

Last 30 days Overall leaderboard