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
zibster
Helper III
Helper III

New Column MAX

Hi,

 

I am trying to add a column that would identifie Max date place "CY" if the date = to max and place "CY" for others, here is my short code that i get error on.

= Table.AddColumn(#"Changed Type", "CyLy", each If(List.Max(#"Changed Type"[txn_dte])=[txn_dte],"CY","LY"))

 

Thanks

Z

1 ACCEPTED SOLUTION
VasTg
Memorable Member
Memorable Member

@zibster 

 

Add a custom column as below.

 

= if [Txn_dte] = List.Max(#"Changed Type"[Txn_dte]) then "CY" else "LY"

 

 

image.png

 

 

Edit: Remember to append previous step name to the column. In my case, "Changed Type" is the previous step and i am referring the date column as List.Max(#"Changed Type"[Txn_dte]) instead of List.Max([Txn_dte])

 

If it helps, mark it as a solution

Kudos are nice too

Connect on LinkedIn

View solution in original post

4 REPLIES 4
VasTg
Memorable Member
Memorable Member

@zibster 

 

Please provide sample data  with expected output to answer the questions correctly.

Connect on LinkedIn

Please see below

 

image.png

 

 

 

VasTg
Memorable Member
Memorable Member

@zibster 

 

Add a custom column as below.

 

= if [Txn_dte] = List.Max(#"Changed Type"[Txn_dte]) then "CY" else "LY"

 

 

image.png

 

 

Edit: Remember to append previous step name to the column. In my case, "Changed Type" is the previous step and i am referring the date column as List.Max(#"Changed Type"[Txn_dte]) instead of List.Max([Txn_dte])

 

If it helps, mark it as a solution

Kudos are nice too

Connect on LinkedIn

Thanks 

 It works perfect 🙂

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.