如何在 Power BI 中将 HOUR 转换为 Between BETWEEN_HOUR?
How to convert HOUR to Between BETWEEN_HOUR in Power BI?
我有 table HOUR 专栏
HOUR
1
2
3
像这样但是我们需要转换成
BETWEEN_HOUR
01:00 - 02:00
02:00 - 03:00
03:00 - 04:00
如何实现相同的
我们必须像下面这样转换
Table.AddColumn(#"Expanded Column1", "BETWEEN_HOUR", each (Text.From((HOUR]) & ':00 - ' &
Text.From([HOUR] + 1) & ":00"))
输出:
BETWEEN_HOUR
01:00 - 02:00
02:00 - 03:00
03:00 - 04:00
我们可以使用高级编辑器和自定义列来使用条件规则来导出条件。
if [HOUR] = 24 then "00:00 - 01:00"
else if [HOUR] = 25 then "01:00 - 02:00"
else if [HOUR] = 26 then "02:00 - 03:00"
else if [HOUR] = 27 then "03:00 - 04:00"
else if [HOUR] = 28 then "04:00 - 05:00"
else if [HOUR] = 29 then "05:00 - 06:00"
else if [HOUR] = 30 then "06:00 - 07:00"
else if [HOUR] = 31 then "07:00 - 08:00"
else if [HOUR] = 8 then "08:00 - 09:00"
else if [HOUR] = 9 then "09:00 - 10:00"
else if [HOUR] = 10 then "10:00 - 11:00"
else if [HOUR] = 11 then "11:00 - 12:00"
else if [HOUR] = 12 then "12:00 - 13:00"
else if [HOUR] = 13 then "13:00 - 14:00"
else if [HOUR] = 14 then "14:00 - 15:00"
else if [HOUR] = 15 then "15:00 - 16:00"
else if [HOUR] = 16 then "16:00 - 17:00"
else if [HOUR] = 17 then "17:00 - 18:00" |
else if [HOUR] = 18 then "18:00 - 19:00"
else if [HOUR] = 19 then "19:00 - 20:00"
else if [HOUR] = 20 then "20:00 - 21:00"
else if [HOUR] = 21 then "21:00 - 22:00"
else if [HOUR] = 22 then "22:00 - 23:00"
else if [HOUR] = 23 then "23:00 - 24:00"
else null
结果:
我有 table HOUR 专栏
HOUR
1
2
3
像这样但是我们需要转换成
BETWEEN_HOUR
01:00 - 02:00
02:00 - 03:00
03:00 - 04:00
如何实现相同的
我们必须像下面这样转换
Table.AddColumn(#"Expanded Column1", "BETWEEN_HOUR", each (Text.From((HOUR]) & ':00 - ' &
Text.From([HOUR] + 1) & ":00"))
输出:
BETWEEN_HOUR
01:00 - 02:00
02:00 - 03:00
03:00 - 04:00
我们可以使用高级编辑器和自定义列来使用条件规则来导出条件。
if [HOUR] = 24 then "00:00 - 01:00"
else if [HOUR] = 25 then "01:00 - 02:00"
else if [HOUR] = 26 then "02:00 - 03:00"
else if [HOUR] = 27 then "03:00 - 04:00"
else if [HOUR] = 28 then "04:00 - 05:00"
else if [HOUR] = 29 then "05:00 - 06:00"
else if [HOUR] = 30 then "06:00 - 07:00"
else if [HOUR] = 31 then "07:00 - 08:00"
else if [HOUR] = 8 then "08:00 - 09:00"
else if [HOUR] = 9 then "09:00 - 10:00"
else if [HOUR] = 10 then "10:00 - 11:00"
else if [HOUR] = 11 then "11:00 - 12:00"
else if [HOUR] = 12 then "12:00 - 13:00"
else if [HOUR] = 13 then "13:00 - 14:00"
else if [HOUR] = 14 then "14:00 - 15:00"
else if [HOUR] = 15 then "15:00 - 16:00"
else if [HOUR] = 16 then "16:00 - 17:00"
else if [HOUR] = 17 then "17:00 - 18:00" |
else if [HOUR] = 18 then "18:00 - 19:00"
else if [HOUR] = 19 then "19:00 - 20:00"
else if [HOUR] = 20 then "20:00 - 21:00"
else if [HOUR] = 21 then "21:00 - 22:00"
else if [HOUR] = 22 then "22:00 - 23:00"
else if [HOUR] = 23 then "23:00 - 24:00"
else null
结果: