Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
DAST
Frequent Visitor

Earliest date from two fact tables as new query/parameter for date table

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:

 

  1. Create a list containing two values:
    • The earliest of column Date in table 1
    • The earliest of column Date in table 2
  2. Select the earliest of the two dates.

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?

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

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



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

3 REPLIES 3
DAST
Frequent Visitor

Thanks both, good to know I was on the right lines - all I was missing was the curly brackets!

BA_Pete
Super User
Super User

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



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Akash_Varuna
Super User
Super User

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.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Solution Authors