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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
DynaNate
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
ImkeF
Super User
Super User

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
ImkeF
Super User
Super User

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

v-shex-msft
Community Support
Community Support

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.