Forum Discussion
Syndicate_Admin
Administrator
4 years agoindefinido
Hola a todos, Quiero crear una tabla que tenga solo el año y el mes entre 2 fechas 2019-12-1 2024-12-31 mi mesa tiene que ser así ¿Podría alguien por favor decirme qué debo hacer?
- 4 years ago
Hay @rima_ch ,
Compruebe la nueva fórmula de tabla.
Table = distinct(SELECTCOLUMNS(CALENDAR(DATE(2019,12,1),DATE(2024,12,31)),"Year",YEAR([Date]),"Month",FORMAT([Date],"MMMM")))Saludos
Arrendajo
Syndicate_Admin
Administrator
4 years agoOtra posible construcción:
let
Start = #date(2019,12,1),
End = #date(2024,12,31),
Years = {Date.Year(Start)..Date.Year(End)},
#"Converted to Table" = Table.FromList(Years, Splitter.SplitByNothing(), {"Year"}),
#"Added Months" = Table.AddColumn(#"Converted to Table", "Month", each {1..12}),
#"Expanded Month" = Table.ExpandListColumn(#"Added Months", "Month"),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Month",{{"Year", Int64.Type}, {"Month", Int64.Type}}),
#"Added Date" = Table.AddColumn(#"Changed Type", "Date", each #date([Year], [Month], 1), type date),
#"Filtered Rows" = Table.SelectRows(#"Added Date", each [Date] >= Start and [Date] <= End),
#"Added Custom" = Table.AddColumn(#"Filtered Rows", "MonthName", each Date.MonthName([Date]), type text)
in
#"Added Custom"
Puede mantener o eliminar las columnas adicionales como desee.
Syndicate_Admin
Administrator
4 years agoMuchas gracias esto es lo que necesito pero podría por favor decirme cómo crearlo Dax y no power query
- Syndicate_Admin4 years ago
Administrator
DAX es un poco más simple en este caso:
MonthlyCalendar = ADDCOLUMNS ( FILTER ( CALENDAR ( DATE ( 2019, 12, 1 ), DATE ( 2024, 12, 31 ) ), DAY ( [Date] ) = 1 ), "Year", YEAR ( [Date] ), "Month", MONTH ( [Date] ), "MonthName", FORMAT ( [Date], "mmmm" ) )