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
Alesitus999
Regular Visitor

Add colum from Date but one year ealier

Hello, 

 

i would like to add a column in power query based on a date but one year earlier.

 

This is my code but it results in an error.

 

let
Origen = FT_Repartido_Actual,
#"Tipo cambiado" = Table.TransformColumnTypes(Origen,{{"Campagne", type text}}),
#"Filas filtradas" = Table.SelectRows(#"Tipo cambiado", each ([Campagne] = "22")),
#"Filas agrupadas" = Table.Group(#"Filas filtradas", {"Gpar_Fuente", "Code_PT"}, {{"MAX", each List.Max([date]), type nullable date}}),
#"Columnas con nombre cambiado" = Table.RenameColumns(#"Filas agrupadas",{{"MAX", "Date"}}),
#"Columna date menos un año"= Date.AddYears(#"Columnas con nombre cambiado",({"Date"}), -1)
in
#"Columna date menos un año"

 

any hints ? Thanks.

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

Use below statement

#"Columna date menos un año"=Table.AddColumn(#"Columnas con nombre cambiado", "New Date", each Date.AddYears([Date],-1))

View solution in original post

1 REPLY 1
Vijay_A_Verma
Super User
Super User

Use below statement

#"Columna date menos un año"=Table.AddColumn(#"Columnas con nombre cambiado", "New Date", each Date.AddYears([Date],-1))

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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.