Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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.
Solved! Go to Solution.
Use below statement
#"Columna date menos un año"=Table.AddColumn(#"Columnas con nombre cambiado", "New Date", each Date.AddYears([Date],-1))
Use below statement
#"Columna date menos un año"=Table.AddColumn(#"Columnas con nombre cambiado", "New Date", each Date.AddYears([Date],-1))
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.