Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fuzzysteve/a1582580f650c608990ec823fe154134 to your computer and use it in GitHub Desktop.
Save fuzzysteve/a1582580f650c608990ec823fe154134 to your computer and use it in GitHub Desktop.
Powerquery getting market type ids from a sheet.
let
Source = Json.Document(Web.Contents("https://market.fuzzwork.co.uk/aggregates/?region=10000002&types="&Text.Combine(Table.ToList(Table.TransformColumnTypes(Table.SelectRows(Excel.CurrentWorkbook(){[Name="typelist"]}[Content], each ([Column1] <> null)),{{"Column1", type text}})),","))),
#"Converted to Table" = Record.ToTable(Source),
#"Expanded Value" = Table.ExpandRecordColumn(#"Converted to Table", "Value", {"buy", "sell"}, {"Value.buy", "Value.sell"}),
#"Expanded Value.buy" = Table.ExpandRecordColumn(#"Expanded Value", "Value.buy", {"weightedAverage", "max", "min", "stddev", "median", "volume", "orderCount", "percentile"}, {"Value.buy.weightedAverage", "Value.buy.max", "Value.buy.min", "Value.buy.stddev", "Value.buy.median", "Value.buy.volume", "Value.buy.orderCount", "Value.buy.percentile"}),
#"Expanded Value.sell" = Table.ExpandRecordColumn(#"Expanded Value.buy", "Value.sell", {"weightedAverage", "max", "min", "stddev", "median", "volume", "orderCount", "percentile"}, {"Value.sell.weightedAverage", "Value.sell.max", "Value.sell.min", "Value.sell.stddev", "Value.sell.median", "Value.sell.volume", "Value.sell.orderCount", "Value.sell.percentile"})
in
#"Expanded Value.sell"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment