Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I need two new queries or parameter to compare and find the earliest and latest dates in the date columns of two fact tables. These two dates are then passed to the date table as its start and end points.
I know what the general structure should be but I don't know enough about M syntax and functions to write it out. I've tried various combinations of Table.AddColumn, List.Generate etc. to no avail. Here's how it looks in my head:
A similar query would find the latest date of both columns. I can then point the date table at these two values/parameters and tell it to start and end at these dates.
Can anyone tell me how to write this in M?
Solved! Go to Solution.
Hi @DAST ,
In Power Query, I think your parameter code should look something like this:
// Start Date
List.Min(
{
List.Min(Query1[DateColumn]),
List.Min(Query2[DateColumn])
}
)
// End Date
List.Max(
{
List.Max(Query1[DateColumn]),
List.Max(Query2[DateColumn])
}
)
Pete
Proud to be a Datanaut!
Thanks both, good to know I was on the right lines - all I was missing was the curly brackets!
Hi @DAST ,
In Power Query, I think your parameter code should look something like this:
// Start Date
List.Min(
{
List.Min(Query1[DateColumn]),
List.Min(Query2[DateColumn])
}
)
// End Date
List.Max(
{
List.Max(Query1[DateColumn]),
List.Max(Query2[DateColumn])
}
)
Pete
Proud to be a Datanaut!
Try these
Create a query to find the earliest date by comparing the minimum dates from the Date columns in both fact tables.
Create another query to find the latest date by comparing the maximum dates from the Date columns in both fact tables.
Use these two queries as parameters (StartDate and EndDate) for the range in your date table.
Generate the date table dynamically by creating a continuous list of dates between the earliest and latest dates.
Check out the July 2025 Power BI update to learn about new features.