类型转换
Power Query M 公式语言包含用于在类型之间进行转换的公式。 下面是 M 中转换公式的汇总。
数字
类型转换 | 说明 |
---|---|
Number.FromText(text as text),数字 | 从文本值返回一个数值。 |
Number.ToText(number as number),文本 | 从数值返回一个文本值。 |
Number.From(value as any),数字 | 从某个值返回一个数字。 |
Int32.From(value as any),数字 | 从给定的值返回一个 32 位整数值。 |
Int64.From(value as any),数字 | 从给定的值返回一个 64 位整数值。 |
Single.From(value as any),数字 | 从给定的值返回单个数值。 |
Double.From(value as any),数字 | 从给定的值返回一个双精度数值。 |
Decimal.From(value as any),数字 | 从给定的值返回一个十进制数值。 |
Currency.From(value as any),数字 | 从给定的值返回货币数值。 |
文本
类型转换 | 说明 |
---|---|
Text.From(value as any),文本 | 返回数字、日期、时间、日期时间、datetimezone、逻辑、持续时间或二进制值的文本表示形式。 |
逻辑
类型转换 | 说明 |
---|---|
Logical.FromText(text as text),逻辑 | 从文本值返回逻辑值 true 或 false。 |
Logical.ToText(logical as logical),文本 | 从逻辑值返回文本值。 |
Logical.From(value as any),逻辑 | 从某个值返回逻辑值。 |
Date、Time、DateTime 和 DateTimeZone
类型转换 | 说明 |
---|---|
.FromText(text as text),作为 Date、Time、DateTime 和 DateTimeZone | 从一组日期格式和区域性值返回 date、time、datetime 和 datetimezone 值。 |
.ToText(date, time, dateTime, or dateTimeZone as date, time, datetime, or datetimezone),作为文本 |
从 date、time、datetime 或 datetimezone 值返回文本值。 |
.From(value as any) | 从某个值返回 date、time、datetime 或 datetimezone 值。 |
.ToRecord(date, time, dateTime, or dateTimeZone as date, time, datetime, or datetimezone) | 返回包含 date、time、datetime 或 datetimezone 值的各个部分的记录。 |
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈