<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Bureau of Labor Statistics issues transforming table in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Bureau-of-Labor-Statistics-issues-transforming-table/m-p/3137307#M41787</link>
    <description>&lt;P&gt;I've made some positive progress on this and better understand how to expand the data out, but I'm having some other issues. Is there a limit on the number of years that can be pulled from BLS? I set my start date as 1990, but it only pulled 20 years of data. If I change it to 1980, then it pulls through 1999, etc. Is the "GetData" function limiting my ability to pull more than 20 years?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my current query and output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = {"WPU057303"},
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(),null,null,ExtraValues.Error),
    #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "SessionID"}}),
    #"Added Custom" = Table.AddColumn(#"Renamed Columns", "Custom", each GetData([SessionID])),
    #"Expanded Table" = Table.ExpandTableColumn(#"Added Custom","Custom",{"Value"}),
    #"Removed Top Rows" = Table.Skip(#"Expanded Table",3),
    #"Expanded Record" = Table.ExpandRecordColumn(#"Removed Top Rows","Value",{"series"}),
    #"Expanded List" = Table.ExpandListColumn(#"Expanded Record","series"),
    #"Expanded series" = Table.ExpandRecordColumn(#"Expanded List","series",{"seriesID","data"}),
    #"Expanded data" = Table.ExpandListColumn(#"Expanded series","data"),
    #"Expanded Records" = Table.ExpandRecordColumn(#"Expanded data","data",{"year","period","periodName","value"})
in
    #"Expanded Records"&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;(sessionid as text) as table =&amp;gt; 
let
    Source = Json.Document(Web.Contents("https://api.bls.gov/publicAPI/v2/timeseries/data/" &amp;amp; sessionid &amp;amp; "?registrationkey=abcdefg123&amp;amp;startyear=1980&amp;amp;endyear=2022")),

    #"Converted to Table" = Record.ToTable(Source)
in
    #"Converted to Table"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mdinius_0-1679000127369.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/888334i50A8132BFAF80380/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mdinius_0-1679000127369.png" alt="mdinius_0-1679000127369.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Mar 2023 20:58:26 GMT</pubDate>
    <dc:creator>mdinius</dc:creator>
    <dc:date>2023-03-16T20:58:26Z</dc:date>
    <item>
      <title>Bureau of Labor Statistics issues transforming table</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Bureau-of-Labor-Statistics-issues-transforming-table/m-p/3136767#M41783</link>
      <description>&lt;P&gt;I've been searching high and low and can't seem to figure out how to transform the data correctly. I've tested the theory in excel, but it doesn't look like there's a direct link between the "Applied Steps" transforming from Excel versus building into the query directly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the data set I'm working with:&amp;nbsp;&lt;A href="https://data.bls.gov/timeseries/WPU057303" target="_blank" rel="noopener"&gt;https://data.bls.gov/timeseries/WPU057303&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried the "GetData" approach as many have listed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(sessionid as text) as table =&amp;gt; 
let
    Source = Json.Document(Web.Contents("https://api.bls.gov/publicAPI/v2/timeseries/data/" &amp;amp; sessionid &amp;amp; "?registrationkey=abcdefg")),

    #"Converted to Table" = Record.ToTable(Source)
in
    #"Converted to Table"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Here is the second query:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
Source = #table({"Column1"},{{"WPU057303"}}),
#"Added Custom" = Table.AddColumn(Source, "Custom", each Json.Document(Web.Contents("https://api.bls.gov/publicAPI/v2/timeseries/data/" &amp;amp; [Column1]))),
    #"Expanded Custom" = Table.ExpandRecordColumn(#"Added Custom", "Custom", {"Results"}, {"Results"}),
    #"Expanded Results" = Table.ExpandRecordColumn(#"Expanded Custom", "Results", {"series"}, {"series"}),
    #"Expanded series" = Table.ExpandListColumn(#"Expanded Results", "series"),
    #"Expanded series1" = Table.ExpandRecordColumn(#"Expanded series", "series", {"data"}, {"data"}),
    #"Expanded data" = Table.ExpandListColumn(#"Expanded series1", "data"),
    #"Expanded data1" = Table.ExpandRecordColumn(#"Expanded data", "data", {"year", "period", "periodName", "latest", "value", "footnotes"}, {"year", "period", "periodName", "latest", "value", "footnotes"}),
    #"Expanded footnotes" = Table.ExpandListColumn(#"Expanded data1", "footnotes"),
    #"Expanded footnotes1" = Table.ExpandRecordColumn(#"Expanded footnotes", "footnotes", {"code", "text"}, {"code", "text"}),
    #"Sorted Rows" = Table.Sort(#"Expanded footnotes1",{{"year", Order.Ascending}})
in
    #"Sorted Rows"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which yields an incomplete data set:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mdinius_0-1678982538431.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/888192iCE622819EB683CFD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mdinius_0-1678982538431.png" alt="mdinius_0-1678982538431.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are the steps taken importing the excel file and transforming:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = Excel.Workbook(File.Contents("File.xlsx"), null, true),
    #"BLS Data Series_Sheet" = Source{[Item="BLS Data Series",Kind="Sheet"]}[Data],
    #"Removed Top Rows" = Table.Skip(#"BLS Data Series_Sheet",11),
    #"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Year", Int64.Type}, {"Jan", type number}, {"Feb", type number}, {"Mar", type number}, {"Apr", type number}, {"May", type number}, {"Jun", type number}, {"Jul", type number}, {"Aug", type number}, {"Sep", type number}, {"Oct", type number}, {"Nov", type number}, {"Dec", type number}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Year"}, "Attribute", "Value"),
    #"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Unpivoted Other Columns", {{"Year", type text}}, "en-US"),{"Year", "Attribute"},Combiner.CombineTextByDelimiter("", QuoteStyle.None),"Merged"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Merged Columns",{{"Merged", type date}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{"Merged", "Date"}}),
    #"Added Custom" = Table.AddColumn(#"Renamed Columns", "Series ID", each "WPU057303"),
    #"Reordered Columns" = Table.ReorderColumns(#"Added Custom",{"Series ID", "Date", "Value"})
in
    #"Reordered Columns"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which gives me this result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mdinius_1-1678982643147.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/888193i2405E0C140433322/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mdinius_1-1678982643147.png" alt="mdinius_1-1678982643147.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm able to establish the connection via API, but I don't quite understand how to transform the data to at least the native table to then start performing the translation to a list. By native table, I'm describing this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mdinius_2-1678982773086.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/888195i919C38E71A29DC62/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mdinius_2-1678982773086.png" alt="mdinius_2-1678982773086.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate the help!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 16:07:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Bureau-of-Labor-Statistics-issues-transforming-table/m-p/3136767#M41783</guid>
      <dc:creator>mdinius</dc:creator>
      <dc:date>2023-03-16T16:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Bureau of Labor Statistics issues transforming table</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Bureau-of-Labor-Statistics-issues-transforming-table/m-p/3137307#M41787</link>
      <description>&lt;P&gt;I've made some positive progress on this and better understand how to expand the data out, but I'm having some other issues. Is there a limit on the number of years that can be pulled from BLS? I set my start date as 1990, but it only pulled 20 years of data. If I change it to 1980, then it pulls through 1999, etc. Is the "GetData" function limiting my ability to pull more than 20 years?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my current query and output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = {"WPU057303"},
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(),null,null,ExtraValues.Error),
    #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "SessionID"}}),
    #"Added Custom" = Table.AddColumn(#"Renamed Columns", "Custom", each GetData([SessionID])),
    #"Expanded Table" = Table.ExpandTableColumn(#"Added Custom","Custom",{"Value"}),
    #"Removed Top Rows" = Table.Skip(#"Expanded Table",3),
    #"Expanded Record" = Table.ExpandRecordColumn(#"Removed Top Rows","Value",{"series"}),
    #"Expanded List" = Table.ExpandListColumn(#"Expanded Record","series"),
    #"Expanded series" = Table.ExpandRecordColumn(#"Expanded List","series",{"seriesID","data"}),
    #"Expanded data" = Table.ExpandListColumn(#"Expanded series","data"),
    #"Expanded Records" = Table.ExpandRecordColumn(#"Expanded data","data",{"year","period","periodName","value"})
in
    #"Expanded Records"&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;(sessionid as text) as table =&amp;gt; 
let
    Source = Json.Document(Web.Contents("https://api.bls.gov/publicAPI/v2/timeseries/data/" &amp;amp; sessionid &amp;amp; "?registrationkey=abcdefg123&amp;amp;startyear=1980&amp;amp;endyear=2022")),

    #"Converted to Table" = Record.ToTable(Source)
in
    #"Converted to Table"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mdinius_0-1679000127369.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/888334i50A8132BFAF80380/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mdinius_0-1679000127369.png" alt="mdinius_0-1679000127369.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 20:58:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Bureau-of-Labor-Statistics-issues-transforming-table/m-p/3137307#M41787</guid>
      <dc:creator>mdinius</dc:creator>
      <dc:date>2023-03-16T20:58:26Z</dc:date>
    </item>
  </channel>
</rss>

