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 / Send a query to a data...
Copilot Studio
Suggested Answer

Send a query to a dataset with parameters

(0) ShareShare
ReportReport
Posted on by 13
Environment
I am using copilot studio, generative responses, using Run a query against a dataset within a topic, publishing agent to Teams.
 
My problem
I can put the DAX Evaluate query into the Run a query against a dataset input field with hard coded params and everything works.  The user can ask a question, the topic triggers, the query runs and returns the results.  I need to now dynamically change the parameter values using variables set/extracted from the user input.  I can extract the values from user input fine, and have them stored in variables, but i am unable to properly replace the placeholders in the DAX.
 
My two topic variables captured are Topic.Timeframe and Topic.Location.  How do insert them into the DAX below.  I have tried Topic.Timeframe, {Topic.Timeframe}, {{Topic.Timeframe}}, """Topic.Timeframe""" etc, but i cannot get the syntax right.
 
Please note:  I cannot use Fabric & MCP, and it is not yet supported in MS Teams.
 
EVALUATE
VAR __Timeframe = "Topic.Timeframe"
VAR __LocationCode = "Topic.Location"

VAR __Today = TODAY()
VAR __WeekStart = __Today - WEEKDAY(__Today, 2) + 1
VAR __WeekEnd   = __WeekStart + 6
VAR __NextWeekStart = __WeekStart + 7
VAR __NextWeekEnd   = __WeekEnd + 7

VAR BaseTable =
    FILTER(
        'view1',
        'view1'[LocationCode] = __LocationCode
        &&
        SWITCH(
            __Timeframe,
            "today",
                INT('view1'[EventDate]) = __Today,
            "tomorrow",
                INT('view1'[EventDate]) = __Today + 1,
            "this week",
                INT('view1'[EventDate]) >= __WeekStart
                && INT('view1'[EventDate]) <= __WeekEnd,
            "next week",
                INT('view1'[EventDate]) >= __NextWeekStart
                && INT('view1'[EventDate]) <= __NextWeekEnd,
            INT('view1'[EventDate]) = __Today
        )
    )
RETURN
    SELECTCOLUMNS(
        BaseTable,
        "LocationCode",   [LocationCode],
        "EventDate",      [EventDate],
        "EventStartTime", [EventStartTime],
        "DeceasedName",   [DeceasedName],
        "EventStatus",    [EventStatus]
    )
ORDER BY [EventDate]
I have the same question (0)
  • Suggested answer
    frago Profile Picture
    226 on at
    In Copilot Studio, the “Run a query against a dataset” input is treated as a string. That means you can’t reference Topic.Timeframe or Topic.Location directly inside DAX (DAX will only see plain text). Instead, you must build the DAX query text dynamically using Power Fx string concatenation (either in a Set variable step or in the query field if it supports fx).
    Key point:
    Your example with & Topic.Timeframe & works only if it’s evaluated as Power Fx (fx-enabled). If you paste it into a plain text field, it won’t be evaluated and will be sent to the dataset as-is.

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 277

#2
11manish Profile Picture

11manish 206

#3
sannavajjala87 Profile Picture

sannavajjala87 156 Super User 2026 Season 1

Last 30 days Overall leaderboard