cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: Wildcard in Navigation Steps

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),

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Wildcard in Navigation Steps

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Highlighted
Super User IV
Super User IV

Re: Wildcard in Navigation Steps

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),

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

Helpful resources

Announcements

August Community Highlights

Check out a full recap of the month!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Solution Authors