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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
atowriss99
Frequent Visitor

Previous Max Date Custom Column Using M

I have created a column to get the Max Date from a Date column in my table and now I want to create a new column to get the Previous Max Date.  

I tried this to get the it:
Table.AddColumn(#"Changed Type10", "Prev Max Rate Date", each Date.From(List.Max(#"Changed Type10"[Rate Start Date]))<(#"Changed Type10"[Max Rate Date])) 

and I get this error:
Expression.Error: We cannot apply operator < to types List and Date.
Details:
Operator=<
Left=[List]
Right=3/16/2024

Here's what I used to get Max Date: 
Table.AddColumn(#"Added Custom3", "Max Rate Date", each Date.From(List.Max(#"Added Custom3"[Rate Start Date])))

What steps do I need to take after adding my Max Date column to get Prev Max date?
Thanks

1 ACCEPTED SOLUTION
v-xinruzhu-msft
Community Support
Community Support

Hi @atowriss99 

You can try the following code.

Table.AddColumn(#"Changed Type10", "Prev Max Rate Date", each List.Max(Table.SelectRows(#"Changed Type10",each [Rate Start Date]<[Max Rate Date])[Rate Start Date]))

 

Best Regards!

Yolo Zhu

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

1 REPLY 1
v-xinruzhu-msft
Community Support
Community Support

Hi @atowriss99 

You can try the following code.

Table.AddColumn(#"Changed Type10", "Prev Max Rate Date", each List.Max(Table.SelectRows(#"Changed Type10",each [Rate Start Date]<[Max Rate Date])[Rate Start Date]))

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors