Forum Discussion

DynaNate's avatar
DynaNate
New Member
7 years ago
Solved

Wildcard in Navigation Steps

Hi,

 

I am new to Power BI.  Is it possible to wildcard what is in red below?  This will change depending on the parameters in the web request.

 

    Source = Json.Document(Web.Contents(APIURL & "/timeseries/" & Encoded & "?includeData=true&aggregationType=" & Aggregation & "&startTimestamp=" & StartTimeEPOCH & "&endTimestamp=" & EndTimeEPOCH & "&predict=false&tag=easytravel&Api-Token=" & APIToken)),
    dataResult = Source[dataResult],
    dataPoints = dataResult[dataPoints],
    #"APPLICATION-4462DAA0020F7410" = dataPoints[#"APPLICATION-4462DAA0020F7410"],
    #"Converted to Table" = Table.FromList(#"APPLICATION-4462DAA0020F7410", Splitter.SplitByNothing(), null, null, ExtraValues.Error),
 

Thanks.

  • Hi DynaNate,

    it seems as if you are trying to select one specific column for the table that has been returned in step "dataPoints".

    If you cannot use the name of the column, you have to use a different identifier. That could be the position of the column for example.

     

    Table.Column(dataPoints, Table.ColumnNames(dataPoints){0}) 

     

    would return the first column from that table (as Power Query is zero based indexed)

     

    Or do you have a different logic after which to select the relevant column?

     

    With regards to the stepname, you can just replace it with a dummy like so:

     

    Source = Json.Document(Web.Contents(APIURL & "/timeseries/" & Encoded & "?includeData=true&aggregationType=" & Aggregation & "&startTimestamp=" & StartTimeEPOCH & "&endTimestamp=" & EndTimeEPOCH & "&predict=false&tag=easytravel&Api-Token=" & APIToken)),
        dataResult = Source[dataResult],
        dataPoints = dataResult[dataPoints],
        DummyStepName = dataPoints[#"APPLICATION-4462DAA0020F7410"],
        #"Converted to Table" = Table.FromList(DummyStepName, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI DynaNate,

     

    You can try to use query formula, I add parameter step and rename functions to convert wildcard fields name to specify one so you can simple extract value from it.

     

    let
        Source = Json.Document(Web.Contents(APIURL & "/timeseries/" & Encoded & "?includeData=true&aggregationType=" & Aggregation & "&startTimestamp=" & StartTimeEPOCH & "&endTimestamp=" & EndTimeEPOCH & "&predict=false&tag=easytravel&Api-Token=" & APIToken)),
        dataResult = Source[dataResult],
        dataPoints = dataResult[dataPoints],
        fieldName = "APPLICATION-4462DAA0020F7410",//cache field name
        #"Rename" = Table.RenameColumns(dataPoints,{{fieldName, "APPLICATION"}})
        #"Extract Field" = #"Rename"[APPLICATION],
        #"Converted to Table" = Table.FromList(#"Extract Field", Splitter.SplitByNothing(), null, null, ExtraValues.Error)
    in
        #"Converted to Table"

    Regards,

    Xiaoxin Sheng

  • ImkeF's avatar
    ImkeF
    Community Champion

    Hi DynaNate,

    it seems as if you are trying to select one specific column for the table that has been returned in step "dataPoints".

    If you cannot use the name of the column, you have to use a different identifier. That could be the position of the column for example.

     

    Table.Column(dataPoints, Table.ColumnNames(dataPoints){0}) 

     

    would return the first column from that table (as Power Query is zero based indexed)

     

    Or do you have a different logic after which to select the relevant column?

     

    With regards to the stepname, you can just replace it with a dummy like so:

     

    Source = Json.Document(Web.Contents(APIURL & "/timeseries/" & Encoded & "?includeData=true&aggregationType=" & Aggregation & "&startTimestamp=" & StartTimeEPOCH & "&endTimestamp=" & EndTimeEPOCH & "&predict=false&tag=easytravel&Api-Token=" & APIToken)),
        dataResult = Source[dataResult],
        dataPoints = dataResult[dataPoints],
        DummyStepName = dataPoints[#"APPLICATION-4462DAA0020F7410"],
        #"Converted to Table" = Table.FromList(DummyStepName, Splitter.SplitByNothing(), null, null, ExtraValues.Error),