The hidden information from the tonavigationtable helper from the Microsoft documentation is the line Preview.DelayColumn = itemNameColumn
, which just does not work together with Function type columns.
So as found out here: https://github.com/migueesc123/PowerBIRESTAPI/blob/master/Power%20BI%20API/PowerBIRESTAPI/PBIAPI.pq you need to have 2(!) navigation table helper functions, one with and one without that line. This also works for functions without parameters.
Like so:
NavigationTable = (url as text) as table =>
let
navigationTableSource = #table(
{ "Name", "Key", "Data", "ItemKind", "ItemName", "IsLeaf" }, {
{ "Topics", "topics", topics(), "Table", "Table", true },
{ "Parameterized Reports","Functions", FunctionsNavTable(), "Folder","Functions",false}
// more navigation elements
}
),
NavTable = Table.ToNavigationTable(navigationTableSource, {"Key"}, "Name", "Data", "ItemKind", "ItemName", "IsLeaf")
in
NavTable;
FunctionsNavTable = () as table =>
let
navigationTableSource = #table(
{"Name","Key","Data","ItemKind","ItemName","IsLeaf"},{
{ "Unique Users Report 1", "unique_users_1", Value.ReplaceType(EventCloudImpl.ReportingApiGateway, ReportingApiGatewayType), "Function", "Function", true },
}
),
NavTable = Table.ForceToNavigationTable(navigationTableSource, {"Key"},"Name","Data","ItemKind","ItemName","IsLeaf")
in
NavTable;