Your prompt should start with a clear question about the data—one specific task at a time—then specify the format and tools you want. For example, "Analyse this CSV file for sales trends by region, using Python code and a bar chart." Avoid vague requests like "give me insights"; instead, name the steps you need, such as "calculate averages," "spot outliers," or "project future values."

How to structure a prompt for data analysis

Copilot responds best when your prompt follows a simple logic: what you want, what data you have, and how you want the results. For example:

  • What: "Identify patterns in customer spending by age group."
  • Data: "Use this Excel table of purchases from 2023."
  • Format: "Generate a Python script with a line chart."

If your data is messy, add a step to clean it: "Remove rows with missing values before calculating." For time-series data, always specify the column names (e.g., "Date, Revenue, Units Sold"). Copilot will ignore unclear references like "the first column" unless you name it.

What to include in your prompt for accuracy

Add these details to avoid errors:

  1. Data source: Attach the file or describe its location (e.g., "uploaded CSV" or "shared Google Sheet"). If the data is large, say "use only the first 1000 rows" to save time.
  2. Format requirements: Ask for specific outputs, such as "return results as a table," "write the code in R," or "export to a PDF with charts."
  3. Assumptions to avoid: If your data has known issues (e.g., "some prices are in USD, some in EUR"), state which column needs conversion.
  4. Business context (optional): For example, "ignore seasonal spikes in Q4" or "compare against last year’s Q2." This helps Copilot filter irrelevant patterns.

Example prompt: "Analyse this sales data for Q1 2024, focusing on product A. Clean the data by removing null values, calculate monthly averages, and flag any months with revenue below $50,000. Use Python and output a line chart with error bars for variability."

Common mistakes and how to fix them

Readers often make these errors:

  • Too broad: Prompts like "tell me about my data" yield generic summaries. Instead, name one task: "find the top 3 regions by revenue."
  • Unclear data references: Saying "the last column" may fail if the order changes. Use column headers (e.g., "the 'Profit' column").
  • Ignoring data quality: Copilot assumes clean data. Add steps like "remove outliers greater than 3 standard deviations" if needed.
  • Overlooking units: Mixing currency or dates without conversion leads to wrong results. Always specify units (e.g., "convert all prices to USD").
  • Missing context: For example, "compare sales to industry benchmarks" requires you to provide the benchmark values or ask Copilot to fetch them.

How to check your results for errors

After Copilot generates output, verify it with these steps:

  1. Recheck the data: Open your raw file and compare the first few rows with Copilot’s output. Look for missing headers or shifted columns.
  2. Validate calculations: For numbers, manually calculate a small subset (e.g., "sum the first 5 rows") to ensure Copilot’s logic matches yours.
  3. Inspect visuals: If charts are included, ask Copilot to "export the data used for this chart" so you can spot inconsistencies (e.g., dates misaligned).
  4. Test edge cases: If your data has gaps (e.g., "no sales in January"), ask Copilot to "explain any missing values" or "warn about gaps."
  5. Compare to known results: If you expect a trend (e.g., "revenue should rise in summer"), ask Copilot to "highlight anomalies" against your expectations.

Example check: "Verify the Python code generates the same average revenue for Product B as my manual calculation of $12,450."

Advanced prompts for specific tasks

Predicting trends

Use time-series data with this template: "Forecast monthly sales for Product C using linear regression, with a 95% confidence interval. Assume seasonal adjustments based on Q2 2023 data."

Add constraints like "ignore months with <20 transactions" to refine accuracy. For long-term trends, specify the horizon (e.g., "predict 12 months ahead").

Detecting anomalies

For fraud or outliers, ask: "Identify unusual spending patterns in this credit card dataset, using Z-score >3. Flag transactions over $1,000 with a status of 'pending'."

Copilot will return code to calculate Z-scores and filter rows. Always review the threshold (3.0 is typical but may vary by dataset).

Comparing datasets

To merge or compare two files, name the columns and join keys. Example: "Merge this customer list with the loyalty program data, matching by 'Email' column. Calculate the average purchase value for each loyalty tier."

If the columns differ, specify how to map them (e.g., "treat 'CustomerID' as the join key").

Generating reports

For automated reports, structure your prompt like this: "Create a monthly dashboard for Department X with:

  • A summary table of key metrics (revenue, costs, headcount).
  • A stacked bar chart of expenses by category.
  • A warning if any metric deviates by >10% from last month.

Use R Markdown and save as a PDF."

What to do if Copilot gives wrong results

If the output is incorrect, start by isolating the cause:

  1. Rephrase the prompt: Replace vague language with specifics. For example, instead of "find trends," say "calculate the moving average with a 3-month window."
  2. Ask for the logic: Type "Explain the steps taken to arrive at this result" to understand where assumptions failed.
  3. Provide examples: If Copilot misinterprets your data format, show it a snippet: "Here’s how the 'Date' column should look: 2024-05-15. Adjust the code accordingly."
  4. Use smaller subsets: Test a 10-row sample first: "Analyse only the first 10 rows of this dataset. Compare your output to my manual check."
  5. Switch tools: If Copilot’s Python/R code fails, ask for an alternative (e.g., "rewrite this as a SQL query").

Example fix: "The chart shows incorrect revenue for Q1. I expect ~$850k; the code returns $620k. Regenerate the chart using the 'Revenue_Cleaned' column, not 'Revenue_Raw'."

FAQ

Can I use Copilot for data cleaning?

Yes. Ask for specific cleaning rules, such as: "Remove rows where 'ShippingDate' is blank or 'Amount' is negative. Standardise currency to USD and replace 'N/A' with 0 in the 'Discount' column."

How do I handle missing data?

Specify the method: "Impute missing values in the 'Age' column using the median age of each region. For categorical data like 'Gender,' fill with the mode."

Can Copilot write SQL queries?

Yes, but name the database type and schema. Example: "Write a SQL query to join the 'orders' and 'customers' tables on 'CustomerID,' filtering for orders placed in 2023. Use PostgreSQL syntax."

What if my data is too large?

Ask for a sample or batch processing: "Process this dataset in chunks of 5000 rows. For each chunk, calculate the average 'OrderValue' and append to a summary table."