Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
5AMsan
Frequent Visitor

Manage function (or table) parameters in Navigation Table

Hello,

I'm trying to add parameters to API calls. OAuth is working and I can generate a list of available datasets in a dynamic navigation table:

5AMsan_0-1661956263330.png

 

Here is the auth screen with no optional parameters, the one I want to appear in the screenshot above (in the right pane):

5AMsan_1-1661956819244.png

 

Now I can't figure out how to allow date and dimension parameters and show on right pane (the one showing error, since dates and dimensions are null).

 

I read the whole TripPin walkthrough several times to end up at this point, but I'm getting lost about parameters and navigation table...

 

Here is some relevant code:

 

 

[DataSource.Kind="PQ_SearchConsole", Publish="PQ_SearchConsole.Publish"]
shared PQ_SearchConsole.Contents = Value.ReplaceType(CreateNavTable, contentsType);
contentsType = type function (
    optional start as (type text meta [
        Documentation.FieldCaption = "Début",
        Documentation.FieldDescription = "Date de début de l'extraction (les mots clés sont autorisés : `today`, `yesterday`, `60daysAgo`).",
        Documentation.SampleValues = {"2022-01-01"}
    ]),
    optional end as (type text meta [
        Documentation.FieldCaption = "Fin",
        Documentation.FieldDescription = "Date de fin de l'extraction (les mots clés sont autorisés : `today`, `yesterday`, `60daysAgo`).",
        Documentation.SampleValues = {"yesterday"}
    ]),
    optional params  as (type nullable text meta [
        Documentation.FieldCaption = "Dimensions",
        Documentation.FieldDescription = "Saisir les dimensions souhaitées",
        Documentation.SampleValues = {"query,page,device,country"}
    ])

) as table [...]
CreateNavTable = (
    optional start as text, 
    optional end as text, 
    optional params as nullable text
) as table => 
    let
        sites = GetSitesList(),
        navBody = List.Accumulate( sites[siteUrl], {}, (state, current)=> state &
            {{current, current, PQ_SearchConsole.GetContents(current,start,end,params), "Function", "Function", true}}
        ),

        navHeader = {"Name","Key","Data","ItemKind", "ItemName", "IsLeaf"}, 
        objects = #table(navHeader, navBody),
        NavTable = Table.ToNavigationTable(objects, {"Key"}, "Name", "Data", "ItemKind", "ItemName", "IsLeaf")
    in
        NavTable
GetSitesList = () as table => 
    let
        source = Json.Document( Web.Contents ( api_base_uri ) ),
        sites = Table.FromRecords( source[siteEntry], type table[siteUrl = Text.Type /*, permissionLevel = Text.Type*/] )
    in
        sites;
PQ_SearchConsole.GetContents = (
    website as text,
    start as text, 
    end as text, 
    params as nullable text
)  =>
    let 
        now =  DateTime.FixedLocalNow(), 

        reqStartDate = Date.From(dateFunc(start)), // #date( Date.Year(now), Date.Month(now) - 1 , Date.Day(now) ),
        reqEndDate = Date.From(dateFunc(end)), //  #date( Date.Year(now), Date.Month(now), Date.Day(now) ),
        reqDimensions = if params="" or params = null then {} else Text.Split(params,","),
        source = Web.Contents( api_base_uri, [
            RelativePath = Text.Combine({Uri.EscapeDataString(website), "/searchAnalytics/query"}), 
            Headers = [#"Content-Type"="application/json"],
            Content = Json.FromValue([startDate = reqStartDate, endDate = reqEndDate, dimension = reqDimensions]) 
        ]),
        report = Json.Document(source)
    in
        report

 

 

 

3 REPLIES 3
5AMsan
Frequent Visitor

I must admit I'm quite puzzled there's no documentation about having parameters for functions or tables exposed as navigation in Power BI. I'm sure some connectors use this, but no way to find anything about this 😕

v-chenwuz-msft
Community Support
Community Support

Hi @5AMsan ,

 

Did you get your problem solved?

Hello @v-chenwuz-msft 

 

Not at all ^^ 
I enjoyed a long week-end and then now I can dive in again!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.