Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Syndicate_Admin
Administrator
Administrator

Anular la dinamización solo de las columnas seleccionadas (columnas de fecha)

Tengo un archivo Excel con la capacidad en horas por mes por máquina en departamento. Este archivo de Excel se actualizará cada mes donde desaparezca el mes más antiguo (a la izquierda) y aparezca un nuevo mes (a la derecha).

4º trimestre de 20231º trimestre de 20242º trimestre de 20243º trimestre de 20244º trimestre de 20241º trimestre de 20252º trimestre de 20253º trimestre de 20254º trimestre de 20251º trimestre de 2026
PriodescripciónDepartamentoDebreviaciónTiempo de esperaID de departamentooct/2323 nov/Dic/23Ene/24feb/24Mar/24Abr/24Mayo/24Jun/24Jul/24Ago/24Sep/24oct/24Nov/24Dic/24Ene/25feb/25Mar/25Abr/25Mayo/25Jun/25Jul/25Ago/25Sep/25Oct/25nov/25Dic/25Ene/26feb/26Mar/26Notas
Ndescription_1ConstrCONSTR2960000000000000000000000000000
Ndescription_2 PM 000000000000000000000000000 Día festivo
Ndescription_3PlanificaciónPLAN2940000000000000000000000000000
Ndescription_4WVBPRO2950000000000000000000000000000

En PowerBi, quiero anular la dinamización de las columnas de fecha después de la actualización de Excel, pero quiero evitar escribir manualmente los nuevos meses en el editor de consultas de PowerBi.

let
    Source = Excel.Workbook(File.Contents("\\onsvfs111.one.nts-group.nl\Data\NTS-Norma\Drachten\BI dashboards\Forecast\Dynamische capaciteit plan.xlsx"), null, true),
    Capaciteit_bewerkingen_periode_Sheet = Source{[Item="Capaciteit_bewerkingen_periode",Kind="Sheet"]}[Data],
    #"Type gewijzigd" = Table.TransformColumnTypes(Capaciteit_bewerkingen_periode_Sheet,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type any}, {"Column6", type any}, {"Column7", type any}, {"Column8", type any}, {"Column9", type any}, {"Column10", type any}, {"Column11", type any}, {"Column12", type any}, {"Column13", type any}, {"Column14", type any}, {"Column15", type any}, {"Column16", type any}, {"Column17", type any}, {"Column18", type any}, {"Column19", type any}, {"Column20", type any}, {"Column21", type any}, {"Column22", type any}, {"Column23", type any}, {"Column24", type any}, {"Column25", type any}, {"Column26", type any}, {"Column27", type any}, {"Column28", type any}, {"Column29", type any}, {"Column30", type any}, {"Column31", type any}, {"Column32", type any}, {"Column33", type any}, {"Column34", type any}, {"Column35", type any}, {"Column36", type any}}),
    #"Rijen gefilterd" = Table.SelectRows(#"Type gewijzigd", each true),
    #"Changed Type" = Table.TransformColumnTypes(#"Rijen gefilterd",{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type any}, {"Column6", type any}, {"Column7", type any}, {"Column8", type any}, {"Column9", type any}, {"Column10", type any}, {"Column11", type any}, {"Column12", type any}, {"Column13", type any}, {"Column14", type any}, {"Column15", type any}, {"Column16", type any}, {"Column17", type any}, {"Column18", type any}, {"Column19", type any}, {"Column20", type any}, {"Column21", type any}, {"Column22", type any}, {"Column23", type any}, {"Column24", type any}, {"Column25", type any}, {"Column26", type any}, {"Column27", type any}, {"Column28", type any}, {"Column29", type any}, {"Column30", type any}, {"Column31", type any}, {"Column32", type any}, {"Column33", type any}, {"Column34", type any}, {"Column35", type any}, {"Column36", type any}}),
    #"Removed Top Rows" = Table.Skip(#"Changed Type",2),
    #"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Prio", type text}, {"Omschrijving", type text}, {"Afdeling", type text}, {"Bewerking", type text}, {"Wacht tijd", Int64.Type}, {"Afdelings ID", Int64.Type}, {"01/10/2023", Int64.Type}, {"01/11/2023", Int64.Type}, {"01/12/2023", Int64.Type}, {"01/01/2024", Int64.Type}, {"01/02/2024", Int64.Type}, {"01/03/2024", Int64.Type}, {"01/04/2024", Int64.Type}, {"01/05/2024", Int64.Type}, {"01/06/2024", Int64.Type}, {"01/07/2024", Int64.Type}, {"01/08/2024", Int64.Type}, {"01/09/2024", Int64.Type}, {"01/10/2024", Int64.Type}, {"01/11/2024", Int64.Type}, {"01/12/2024", Int64.Type}, {"01/01/2025", Int64.Type}, {"01/02/2025", Int64.Type}, {"01/03/2025", Int64.Type}, {"01/04/2025", Int64.Type}, {"01/05/2025", Int64.Type}, {"01/06/2025", Int64.Type}, {"01/07/2025", Int64.Type}, {"01/08/2025", Int64.Type}, {"01/09/2025", Int64.Type}, {"01/10/2025", Int64.Type}, {"01/11/2025", Int64.Type}, {"01/12/2025", Int64.Type}, {"01/01/2026", Int64.Type}, {"01/02/2026", Int64.Type}, {"01/03/2026", Int64.Type}, {"Opmerkingen", type text}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type1", each ([Bewerking] <> null)),
    #"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Afdeling", "Bewerking", "Wacht tijd", "Afdelings ID", "01/10/2023", "01/11/2023", "01/12/2023", "01/01/2024", "01/02/2024", "01/03/2024", "01/04/2024", "01/05/2024", "01/06/2024", "01/07/2024", "01/08/2024", "01/09/2024", "01/10/2024", "01/11/2024", "01/12/2024","01/01/2025", "01/02/2025", "01/03/2025", "01/04/2025", "01/05/2025", "01/06/2025", "01/07/2025", "01/08/2025", "01/09/2025", "01/10/2025", "01/11/2025", "01/12/2025","01/01/2026", "01/02/2026", "01/03/2026"}),
    #"Unpivoted Only Selected Columns" = Table.Unpivot(#"Removed Other Columns", {"01/10/2023", "01/11/2023", "01/12/2023", "01/01/2024", "01/02/2024", "01/03/2024", "01/04/2024", "01/05/2024", "01/06/2024", "01/07/2024", "01/08/2024", "01/09/2024", "01/10/2024", "01/11/2024", "01/12/2024","01/01/2025", "01/02/2025", "01/03/2025", "01/04/2025", "01/05/2025", "01/06/2025", "01/07/2025", "01/08/2025", "01/09/2025", "01/10/2025", "01/11/2025", "01/12/2025","01/01/2026", "01/02/2026", "01/03/2026"}, "Attribute", "Value"),
    #"Renamed Columns" = Table.RenameColumns(#"Unpivoted Only Selected Columns",{{"Attribute", "Datum"}, {"Value", "Capaciteit"}, {"Afdelings ID", "AfdelingsID"}, {"Wacht tijd", "Wachttijd"}, {"Bewerking", "Bewerkingsplaats"}}),
    #"Added Custom" = Table.AddColumn(#"Renamed Columns", "Check", each if DateTime.From([Datum]) >= Date.StartOfMonth(DateTime.LocalNow()) then true else false),
    #"Filtered Rows1" = Table.SelectRows(#"Added Custom", each true),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows1",{"Check", "Afdeling"}),
    #"Changed Type2" = Table.TransformColumnTypes(#"Removed Columns",{{"Datum", type date}}),
    #"Added Custom1" = Table.AddColumn(#"Changed Type2", "Custom", each ([Capaciteit] * 52) / 12),
    #"Removed Columns1" = Table.RemoveColumns(#"Added Custom1",{"Capaciteit"}),
    #"Renamed Columns1" = Table.RenameColumns(#"Removed Columns1",{{"Custom", "Capaciteit"}}),
    #"Changed Type3" = Table.TransformColumnTypes(#"Renamed Columns1",{{"Capaciteit", type number}})
in
    #"Changed Type3"

en este código M, los meses se escriben manualmente. Pregunta ¿cómo hacer esta dinámica por la información de Excel?

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

Hola @shuijgen ,

Me alegra saber que su problema se ha resuelto, por favor márquelo amablemente como la solución. Más personas se beneficiarán de ello.

Gracias por sus esfuerzos y tiempo de antemano.

Saludos
Apoyo de la comunidad Team_Binbin Yu
Si esta publicación Ayuda, entonces por favor considere Acéptalo como la solución para ayudar a los demás miembros a encontrarlo más rápidamente.

Syndicate_Admin
Administrator
Administrator

un poco de google y encontré un video útil

https://www.youtube.com/watch?v=yJGdfh1Fo5E

= Table.Unpivot(#"Removed Other Columns", List.Select(Table.ColumnNames(#"Removed Other Columns"), each Text.Contains(_,"/",Comparer.OrdinalIgnoreCase)), "Attribute", "Value")

cambié un poco a mis datos y parece funcionar.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.

Top Kudoed Authors