Query Editor - Json formating

TheVulcan

New Member
Joined
Jul 17, 2011
Messages
9

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
I would use multiple Queries.


Name: WebQuery24hVolume

Code:
let
    Source = Json.Document(Web.Contents("https://poloniex.com/public?command=return24hVolume")),
    #"Converted to Table" = Record.ToTable(Source)
in
    #"Converted to Table"

Name: 24hVolumeRecords

Code:
let
    Source = WebQuery24hVolume,
    #"Filtered Rows" = Table.SelectRows(Source, each not Text.Contains([Name], "total")),
    #"Expanded Value" = Table.ExpandRecordColumn(#"Filtered Rows", "Value", {"BTC", "BCN", "BELA"}, {"BTC", "BCN", "BELA"})
in
    #"Expanded Value"

Name: 24hVolumeOther

Code:
let
    Source = WebQuery24hVolume,
    #"Filtered Rows" = Table.SelectRows(Source, each Text.Contains([Name], "total"))
in
    #"Filtered Rows"
 
Upvote 0
Thank you for your response it is much appreciated, it has helped and raised more direct questions.



1. Was this hand coded or achieved using the UI buttons ?
To use it I created a new query and converted to table.
Then created x2 new blank queries and inserted your code.



2.
Code:
[COLOR=#574123]#"Expanded Value" = Table.ExpandRecordColumn(#"Filtered Rows", "Value", {"BTC", "BCN", "BELA"}, {"BTC", "BCN", "BELA"})[/COLOR]

This expands out the first 3 items, as there is no expand all button on the column, how was this achieved and how do you expand all ?



3.
This creates to following table.
NameBTCBCNBELA
BTC_BCN305.49074673365734638.53647786
BTC_BELA142.060556511484532.34906018

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>



How would you change it to
NameBTC24Hour Volume
BTC_BCN305.49074673365734638.53647786
BTC_BELA142.060556511484532.34906018

<colgroup><col><col><col></colgroup><tbody>
</tbody>




Sorry for the Newbie questions, I didn't even know Power Query existed and have never used Json data before.
Trying to get a grasp of how it all works so I can start hobbling stuff together.
 
Upvote 0
Maybe this way:
Code:
= Table.AddColumn(#"Changed Type", "24Hour Volume", each if [BCN] <> null then [BCN] else [BELA])
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,692
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top