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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.