Reputation: 108
Can someone please help me with custom column code in Power BI Query Editor. I wish to get a value "Latest" in custom column against "CRTG-0006" as 0006 is the highest number in the column. CRTG-0006 is the latest version of the Program CRTG & CRTG-0001 being the first version of the Program. In future, let's say if I add "CRTG-0007" file in the root folder, Custom Column return value shall be "Latest" for "CRTG-0007" and shall be "null" for "CRTG-0006" and all previous versions of the Program.
Upvotes: 0
Views: 197
Reputation: 60174
Given your layout,
Program
#"Changed Step
if [Program] = List.Max(#"Changed Type"[Program]) then "Latest" else null
This works because your format is such that simple alphabetical sorting will work. The program name/abbreviation is always the same, and the version number is padded with zero's
By the way, if you have multiple programs in the Program column, I would group by the program base name, and apply the same algorithm in a custom aggregation.
Upvotes: 1
Reputation: 21298
It's a bit hard to tell what you want but you can right click then split the column on - to get the number. You can then convert type to numerical and sort or take the List.Max([ColumnName])
Upvotes: 1