Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowTry your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now
ISSUE:
After changing the order of one statement in the M script, the column data type of a few columns changes and ignores the explicit Table.TransformColumnTypes() depending where it is located in the script.
If this code:
let
Source = PowerPlatform.Dataflows([]),
#"Navigation 1" = Source{[Id = "Workspaces"]}[Data],
#"Navigation 2" = #"Navigation 1"{[workspaceId = ""]}[Data],
Navigation = #"Navigation 2"{[dataflowId = ""]}[Data],
#"Navigation 3" = Navigation{[entity = "FACT_RWS", version = ""]}[Data],
#"Filtered rows" = Table.SelectRows(#"Navigation 3", each [INDEX] > IncrementalIndex),
#"Changed column type" = Table.TransformColumnTypes(
#"Filtered rows",
{
{"DATE", type date},
{"TIME", type datetime},
{"HOUR", type datetime},
{"M15", type datetime},
{"ATMOSPHERIC_PRESSURE", Int64.Type},
{"BATTERY_STATUS", Int64.Type},
{"PAVEMENT_CHEMICAL_CONCENTRATION", Int64.Type},
{"PAVEMENT_BLOCK", Int64.Type},
{"PRECIPITATION_SITUATION", Int64.Type},
// {"RELATIVE_HUMIDITY", Percentage.Type}, // do not cast, random INT64 overflow error ensues, WTF!?
{"VISIBILITY", Int64.Type},
{"WIND_GUST_DIRECTION", Int64.Type},
{"WIND_GUST_SPEED", Int64.Type},
{"SOLAR_RADIATION", Int64.Type}
}
)
in
#"Changed column type"
// #"Filtered rows"
the column types look like this and are correct:
But this code, in which the #"Filtered rows" statement is put at the very end of the M script,
let
Source = PowerPlatform.Dataflows([]),
#"Navigation 1" = Source{[Id = "Workspaces"]}[Data],
#"Navigation 2" = #"Navigation 1"{[workspaceId = "142e0ce2-c040-436d-8eb8-58aea822ed45"]}[Data],
Navigation = #"Navigation 2"{[dataflowId = "750bf43a-f676-4b77-a763-eea54958a1b6"]}[Data],
#"Navigation 3" = Navigation{[entity = "FACT_RWS", version = ""]}[Data],
#"Changed column type" = Table.TransformColumnTypes(
#"Navigation 3",
{
{"DATE", type date},
{"TIME", type datetime},
{"HOUR", type datetime},
{"M15", type datetime},
{"ATMOSPHERIC_PRESSURE", Int64.Type},
{"BATTERY_STATUS", Int64.Type},
{"PAVEMENT_CHEMICAL_CONCENTRATION", Int64.Type},
{"PAVEMENT_BLOCK", Int64.Type},
{"PRECIPITATION_SITUATION", Int64.Type},
// {"RELATIVE_HUMIDITY", Percentage.Type}, // do not cast, random INT64 overflow error ensues, WTF!?
{"VISIBILITY", Int64.Type},
{"WIND_GUST_DIRECTION", Int64.Type},
{"WIND_GUST_SPEED", Int64.Type},
{"SOLAR_RADIATION", Int64.Type}
}
)
#"Filtered rows" = Table.SelectRows(#"Navigation 3", each [INDEX] > IncrementalIndex)
in
//#"Changed column type"
#"Filtered rows"
causes the column types to be incorrect insofar that they now ignore the specific Table.TransformColumnTypes() command:
Finally, IncrementalIndex is another query:
let
Source = Lakehouse.Contents(null){[workspaceId = ""]}[Data]{[lakehouseId = ""]}[Data],
#"Navigation 1" = Source{[Id = "FACT_RWS", ItemKind = "Table"]}[Data],
#"Drill down" = #"Navigation 1"[INDEX],
#"Calculated maximum" = List.Max(#"Drill down")
in
#"Calculated maximum"
Why? Am I missing something or...?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.