Forum Discussion

RobertO995's avatar
RobertO995
Frequent Visitor
7 years ago
Solved

list max

Hello all,

 

I need your help with List.Max in PowerBi. I'm totally new in M language and even simply things make a lot of troubles for me.

 

I have separated columns with date and year. For example: one column is 01/01/2018 and second is just 2018. In my table I have dates from 2017 to 2019 and I want to create another column with the maximum year in every row - so in this case, every row (in dates from 2017 to 2019) will be 2019, in the next year it will be 2020 (this is because I'm using operational years instead of calendar).

 

I guess, I need to use List.Max function, but got some issues with that. 

 

If I try List.Max([Year column]) - I received "Cannot convert 2019 value to List type,

If I try List.Max[Year column] - I received "Cannot use access to filed for type Function"

 

The only way, I received what I want was to copy the whole table, match column with year, click 'convert to list' button, and then add another column and use List.Max function, but I have a few questions:

 

1) will this list refresh automatically if the new dates will appear?

2) Is there simplier way to receive max year in another column in every row?

 

Thanks in advance!

 

 

1 Reply

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Community Champion

    RobertO995

     

    Hi,

     

    Just add the previous step reference in your List.Max function

     

    for example

     

    List.Max(#"Changed Type"[Year])