Power Query Problems

How to Find New Appointments Using Multiple Columns in Power Query

Maira MehtabMaira Mehtab Nov 3, 2026 869 views

Question details

The user needs to compare rolling appointment reports to label records as 'New' or 'Existing' based on multiple columns, such as patient ID and appointment date.

How to Find New Appointments Using Multiple Columns in Power Query
Product
Microsoft Excel (Power Query)
Device & OS
not provided
Scenario
Comparing appointments on a current day with corresponding appointments in the two previous daily reports to check for new entries.
Observed behavior
The goal is to mark an appointment as 'New' if it was absent from the previous two reports, and 'Existing' otherwise, using Power Query M code instead of relying on Microsoft 365 specific formulas.
Before you start

Ensure your dataset contains properly formatted columns for patient IDs, appointment dates, and report generation dates before applying Power Query transformations.

Solution 1Recommended

Use Power Query Grouping and Custom Columns

Apply M code transformations to group records and dynamically compare report dates.

By grouping your data by Patient ID and Appointment Date, you can isolate specific appointment instances. Using M code, you can then evaluate whether an appointment existed in prior reports by comparing the report dates.

1
Format the report date column

Open the Power Query Editor, select your report-date column, and change its data type to Date to ensure accurate chronological sorting.

2
Identify the baseline report date

Use the Advanced Editor to define a 'firstReportDate' variable using the List.Min function. This provides a baseline reference to determine historical presence.

3
Group data by relevant columns

Select both the Patient ID and Appointment Date columns. Right-click the header and choose 'Group By' to consolidate the records into grouped tables.

4
Add conditional checking logic

Create a Custom Column within the grouped data that checks if the appointment was absent in the two previous reports. Set the logic to output 'New' if absent, and 'Existing' if present.

5
Expand and clean up the results

Remove the temporary grouping columns, click the expand icon on your custom column to restore the standard table view, and sort the output as needed.

Use Power Query Grouping and Custom Columns
Advanced Editor Control: Writing the M code directly in the Advanced Editor provides much finer control over list manipulations and conditional logic than relying solely on the graphical interface.
Free Microsoft Office alternative

Handle complex data comparisons easily with WPS Office

While advanced Power Query M scripting is specific to Microsoft Excel, you can often achieve similar multi-column data comparisons—like finding new or existing records—using standard array formulas and advanced filtering in WPS Spreadsheet, a free, fast, and highly compatible alternative to Microsoft Office.

Fully compatible with Microsoft Excel file formats (.xlsx, .xls, .csv).Robust standard formula support (VLOOKUP, COUNTIFS, IF) for data comparison.Free, lightweight, and fast installation on any operating system.Familiar user interface makes complex data analysis seamless without a steep learning curve.
microsoft office alternative - wps office

Frequently Asked Questions

Can I compare multiple columns in Power Query without Microsoft 365?

Yes, Power Query is available as a standalone add-in for older versions like Excel 2010 and 2013, and is built natively into Excel 2016 and later versions as 'Get & Transform', entirely independent of a Microsoft 365 subscription.

How do I group by multiple columns in Power Query?

Select the columns you want to group by (e.g., Patient ID and Appointment Date) while holding down the Ctrl key, right-click one of the highlighted headers, and choose 'Group By' from the context menu.

Why use List.Min for date comparisons in Power Query?

Using List.Min allows you to dynamically find the earliest date in your grouped report-date list. This provides a baseline reference to determine whether an appointment existed in a previous reporting cycle.

Are DAX and Power Query the same thing?

No. Power Query uses M code to extract, transform, and load (ETL) data before it reaches the spreadsheet. DAX (Data Analysis Expressions) is a formula language used in Power Pivot to analyze and calculate data that has already been loaded into the Data Model.