Table.TransformColumnTypes
Syntaxe
Table.TransformColumnTypes(table as table, typeTransformations as list, optional culture as nullable text) as table
Asi
Vrátí tabulku použitím transformačních operací na zadané sloupce s volitelnou kulturou.
-
table
: Vstupní tabulka, která se má transformovat. -
typeTransformations
: Transformace typu, které se mají použít. Formát jedné transformace je { název sloupce, hodnota typu }. Seznam transformací lze použít ke změně typů více než jednoho sloupce najednou. Pokud sloupec neexistuje, vyvolá se chyba. -
culture
: (Volitelné) Kulturní nastavení, které se má použít při transformaci typů sloupců (například "en-US").
Hodnota typu v parametru typeTransformations
může být any
, všechny typy number
, text
, všechny date
, time
, datetime
, datetimezone
a typy duration
, logical
nebo binary
. Typy list
, record
, table
nebo function
nejsou pro tento parametr platné.
Příklad 1
Transformujte číselné hodnoty v prvním sloupci na textové hodnoty.
Využití
let
Source = #table(type table [a = number, b = number],
{
{1, 2},
{3, 4}
}),
#"Transform Column" = Table.TransformColumnTypes(
Source,
{"a", type text}
)
in
#"Transform Column"
výstupní
#table(type table [a = text, b = number],
{
{"1", 2},
{"3", 4}
})
Příklad 2
Transformujte kalendářní data v tabulce na ekvivalenty francouzského textu.
Využití
let
Source = #table(type table [Company ID = text, Country = text, Date = date],
{
{"JS-464", "USA", #date(2024, 3, 24)},
{"LT-331", "France", #date(2024, 10, 5)},
{"XE-100", "USA", #date(2024, 5, 21)},
{"RT-430", "Germany", #date(2024, 1,18)},
{"LS-005", "France", #date(2023, 12, 31)},
{"UW-220", "Germany", #date(2024, 2, 25)}
}),
#"Transform Column" = Table.TransformColumnTypes(
Source,
{"Date", type text},
"fr-FR"
)
in
#"Transform Column"
výstupní
#table(type table [Company ID = text, Country = text, Date = text],
{
{"JS-464", "USA", "24/03/2024"},
{"LT-331", "France", "05/10/2024"},
{"XE-100", "USA", "21/05/2024"},
{"RT-430", "Germany", "18/01/2024"},
{"LS-005", "France", "31/12/2023"},
{"UW-220", "Germany", "25/02/2024"}
})
Příklad 3
Transformujte kalendářní data v tabulce na jejich německé textové ekvivalenty a hodnoty v tabulce na procenta.
Využití
let
Source = #table(type table [Date = date, Customer ID = text, Value = number],
{
{#date(2024, 3, 12), "134282", .24368},
{#date(2024, 5, 30), "44343", .03556},
{#date(2023, 12, 14), "22", .3834}
}),
#"Transform Columns" = Table.TransformColumnTypes(
Source,
{{"Date", type text}, {"Value", Percentage.Type}},
"de-DE")
in
#"Transform Columns"
výstupní
#table(type table [Date = text, Customer ID = text, Value = Percentage.Type],
{
{"12.03.2024", "134282", .24368},
{"30.05.2024", "44343", .03556},
{"14.12.2023", "22", .3834}
})