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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Check for earliest date in table for comparison using M results in cyclic error

In Power Query, I have a table which has a date column. I want to write a custom column that checks if the date is the minimum date for that field, then return true, else false.

 

if List.Contains({List.Min(#"Table"[Date])},[Date]) then true else false

 

Do I need to have a separate object for comparison? I would never use this minimum date in another location, and if possible would like to avoid creating a referenced table or something similar.

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

To get the minimum date in a column, please refer to this syntax:

AddCustom = Table.AddColumn(PreviousStep, "Custom", each List.Max(PreviousStep[a]))

 

Then, wrap above step inside an if condition.

= Table.AddColumn(#"Changed Type", "Custom.1", each if [Date]=List.Min(#"Changed Type"[Date]) then "true" else "false")

1.PNG

 

Best regards,

Yuliana Gu

 

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

To get the minimum date in a column, please refer to this syntax:

AddCustom = Table.AddColumn(PreviousStep, "Custom", each List.Max(PreviousStep[a]))

 

Then, wrap above step inside an if condition.

= Table.AddColumn(#"Changed Type", "Custom.1", each if [Date]=List.Min(#"Changed Type"[Date]) then "true" else "false")

1.PNG

 

Best regards,

Yuliana Gu

 

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello @v-yulgu-msft,

 

what condition would I need to add in order to get the minimun date for each site?

 

Best Regards

Anonymous
Not applicable

@ratercero I ended up just bringing in a second reference to the table for another situation, grouping on the ID and value, then merging it in to make it work. I found that even if I could make more of it work in a single step that it ended up hurting readability for anyone else coming in after me.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.