Cross Tab Query in Power Query

vibajajo64

New member
Joined
May 27, 2018
Messages
1
Reaction score
0
Points
0
Excel Version(s)
2013
The data I have is in a snapshot format but I'd like to use a crosstab query to put the data in a sortable format. This is the way I'd like it to look: I've attached the excel file. Thanks for any help.

Ticker....Index................Market Cap..... Income..... Sales
abx...... DJIA.S&P500........15.74B.........574.00M.... 8.17B ................and so on
aapl..... DJIA S&P500.......947.59B........ 55.92B....247.42B................and so on


And this is the current snapshot format below which I'd like to change with a crosstab query.


TickerCustom.Column1Custom.Column2Custom.Column3Custom.Column4Custom.Column5Custom.Column6Custom.Column7Custom.Column8Custom.Column9Custom.Column10Custom.Column11Custom.Column12
abxIndexDJIA S&P500P/E27.22EPS (ttm)0.49Insider Own0.10%Shs Outstand1.18BPerf Week1.75%
abxMarket Cap15.74BForward P/E18.47EPS next Y0.73Insider Trans0.00%Shs Float1.16BPerf Month-1.69%
abxIncome574.00MPEGEPS next Q0.16Inst Own72.10%Short Float1.31%Perf Quarter9.57%
abxSales8.17BP/S1.93EPS this Y67.00%Inst Trans-2.19%Short Ratio1.36Perf Half Y-5.30%
abxBook/sh8.12P/B1.65EPS next Y-4.10%ROA3.60%Target Price15.96Perf Year-17.80%
abxCash/sh2.03P/C6.6EPS next 5Y-4.45%ROE9.60%52W Range11.07 - 18.35Perf YTD-7.46%
abxDividend0.12P/FCF27.91EPS past 5Y36.10%ROI11.10%52W High-27.03%Beta-0.14
abxDividend %0.90%Quick Ratio1.7Sales past 5Y-10.30%Gross Margin40.50%52W Low20.96%ATR0.27
abxEmployees18421Current Ratio2.8Sales Q/Q-10.20%Oper. Margin27.00%RSI (14)56.07Volatility2.11% 1.72%
abxOptionableYesDebt/Eq0.68EPS Q/Q-76.80%Profit Margin11.20%Rel Volume0.53Prev Close13.48
abxShortableYesLT Debt/Eq0.67EarningsApr 23 AMCPayout15.30%Avg Volume11.19MPrice13.39
abxRecom2.90SMA200.0018SMA502.99%SMA200-7.19%Volume5,878,240Change-0.67%
aaplIndexDJIA S&P500P/E17.37EPS (ttm)10.85Insider Own0.06%Shs Outstand5.02BPerf Week1.22%
aaplMarket Cap947.59BForward P/E14.21EPS next Y13.27Insider Trans-10.36%Shs Float4.91BPerf Month14.83%
aaplIncome55.92BPEG1.29EPS next Q2.18Inst Own61.90%Short Float0.94%Perf Quarter5.37%
aaplSales247.42BP/S3.83EPS this Y10.80%Inst Trans-Short Ratio1.44Perf Half Y7.78%
aaplBook/sh25.25P/B7.47EPS next Y15.53%ROA14.30%Target Price197.02Perf Year22.56%
aaplCash/sh17.50P/C10.78EPS next 5Y13.45%ROE40.00%52W Range142.20 - 190.37Perf YTD11.43%
aaplDividend2.92P/FCF20.16EPS past 5Y7.90%ROI18.30%52W High-0.94%Beta1.29
aaplDividend %1.55%Quick Ratio1.4Sales past 5Y7.90%Gross Margin38.30%52W Low32.62%ATR3.18
aaplEmployees123000Current Ratio1.5Sales Q/Q15.60%Oper. Margin26.70%RSI (14)67.04Volatility1.27% 1.64%
aaplOptionableYesDebt/Eq0.96EPS Q/Q30.10%Profit Margin21.50%Rel Volume0.53Prev Close188.15
aaplShortableYesLT Debt/Eq0.8EarningsMay 01 AMCPayout24.20%Avg Volume32.22MPrice188.58
aaplRecom2.00SMA200.0309SMA507.33%SMA20011.58%Volume17,225,551Change0.23%
 

Attachments

  • NewWorldVincent.xlsx
    37 KB · Views: 13
Last edited:
I have no idea if this is what you need...but what about this:

Code:
let
    Source = {"abx","aapl","goog","hl","vz","pvh","amzn","snap","fb","nvda"},
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Ticker"}}),
    #"Get Data" = Table.AddColumn(#"Renamed Columns", "Custom", each GetData([Ticker])),
    #"Transpose Data" = Table.AddColumn(#"Get Data", "Transpose", each Table.PromoteHeaders(Table.Transpose([Custom]), [PromoteAllScalars=true])),
    #"Removed Columns" = Table.RemoveColumns(#"Transpose Data",{"Custom"}),
    #"Expanded Transpose" = Table.ExpandTableColumn(#"Removed Columns", "Transpose", {"Index", "Market Cap", "Income", "Sales", "Book/sh", "Cash/sh", "Dividend", "Dividend %", "Employees", "Optionable", "Shortable", "Recom"}, {"Index", "Market Cap", "Income", "Sales", "Book/sh", "Cash/sh", "Dividend", "Dividend %", "Employees", "Optionable", "Shortable", "Recom"})
in
    #"Expanded Transpose"
 
Back
Top