Forum Discussion
Power Query: List.Max doesn't work on Date
- 8 years ago
Hi ovetteabejuela,
As I tested, you need to create the date column as a list, then use it in List.Max(). I have the following sample table.2. Create a custom column using the formula.
=List.Max(#"Changed Type"[Date])
3. You will get the expected result as follows.
Best Regards,
Angelia
This has been answered but the steps are not fully clear, for the New Power BI User I will break down the solution:
There currently is NO data type of "List", just make sure you have the column as Data or Number.
Here is where the confusing part comes in as the actual "List.Max()" function isnt complete in syntax you either have to know exactly how to code it or you need to make an adjustment in Advanced Editor Section to manualy type in the previous Query Step Name as "Table" reference.
I create a new Column I type the following in the column formual page "=List.Max({INSERT COLUMN NAME})" Add Column
THEN I go into Advanced Editor and Copy the Query Name from the prior step in the front of my INSERTED COLUMN NAME.
BEFORE:
#"Changed column type" = Table.TransformColumnTypes(Navigation, {{"ci_item_time", type date}}), #"Added custom" = Table.AddColumn(#"Changed column type", "Custom", each List.Max([ci_item_time]))
AFTER:
#"Changed column type" = Table.TransformColumnTypes(Navigation, {{"ci_item_time", type date}}),
#"Added custom" = Table.AddColumn(#"Changed column type", "Custom", each List.Max(#"Changed column type"[ci_item_time]))
NOW if you knew what your prior Query Step name was you could have manually coded this into the New Column Formula statement like List.Max(#"Changed column type"[ci_item_time]) I hope this clears up any confusion on this Topic.
E I L O O P