<?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: List.Transform referencing column returns different data in Power Query</title>
    <link>https://community.fabric.microsoft.com/t5/Power-Query/List-Transform-referencing-column-returns-different-data/m-p/1384130#M43500</link>
    <description>&lt;P&gt;Hello &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="260034" data-lia-user-login="foged" class="lia-mention lia-mention-user"&gt;foged&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;your code is saying, that you are a creating a list with 4 items, and all items have the value of the column "months", not with the column "ReportDate"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What exactly should this list contain?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jimmy&lt;/P&gt;</description>
    <pubDate>Mon, 21 Sep 2020 10:28:43 GMT</pubDate>
    <dc:creator>Jimmy801</dc:creator>
    <dc:date>2020-09-21T10:28:43Z</dc:date>
    <item>
      <title>List.Transform referencing column returns different data</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/List-Transform-referencing-column-returns-different-data/m-p/1384079#M43499</link>
      <description>&lt;P&gt;I am building a power query adding a list of dates using List.Transform. I reference an existing column using (thisrow) inline custom function, however the populated list, referencing the same column returns random data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;let&lt;BR /&gt;Source = OData.Feed("....", null, [Implementation="2.0"]),&lt;BR /&gt;#"Add Custom" = Table.AddColumn(Source, "ReportDate", each [PeriodStart], type date),&lt;BR /&gt;#"Add Months" = Table.AddColumn(#"Add Custom", "Months", each (Duration.Days([PeriodEnd]-[PeriodStart]))),&lt;BR /&gt;#"MonthList" = Table.AddColumn(&lt;BR /&gt;#"Add Months", "DateList", &lt;BR /&gt;(ThisRow) =&amp;gt; List.Transform(&lt;BR /&gt;{0..3}, &lt;BR /&gt;each &lt;BR /&gt;ThisRow[Months] )&lt;BR /&gt;, type list&lt;BR /&gt;)&lt;BR /&gt;in&lt;BR /&gt;MonthList&lt;/PRE&gt;&lt;P&gt;When I look at the List generated (0..3) each item in the list, does not corrospond with the data stored in the ReportDate column. Any idea?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2020 10:18:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/List-Transform-referencing-column-returns-different-data/m-p/1384079#M43499</guid>
      <dc:creator>foged</dc:creator>
      <dc:date>2020-09-21T10:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: List.Transform referencing column returns different data</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/List-Transform-referencing-column-returns-different-data/m-p/1384130#M43500</link>
      <description>&lt;P&gt;Hello &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="260034" data-lia-user-login="foged" class="lia-mention lia-mention-user"&gt;foged&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;your code is saying, that you are a creating a list with 4 items, and all items have the value of the column "months", not with the column "ReportDate"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What exactly should this list contain?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jimmy&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2020 10:28:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/List-Transform-referencing-column-returns-different-data/m-p/1384130#M43500</guid>
      <dc:creator>Jimmy801</dc:creator>
      <dc:date>2020-09-21T10:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: List.Transform referencing column returns different data</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/List-Transform-referencing-column-returns-different-data/m-p/1384162#M43501</link>
      <description>&lt;P&gt;Hi Jimmy, thanks for reaching the item. My sample (was posted) was referencing both [months] (number column) to test and also the [reportdate] (date column).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the sample view when referencing the [ReportDate] column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2020 10:37:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/List-Transform-referencing-column-returns-different-data/m-p/1384162#M43501</guid>
      <dc:creator>foged</dc:creator>
      <dc:date>2020-09-21T10:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: List.Transform referencing column returns different data</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/List-Transform-referencing-column-returns-different-data/m-p/1386074#M43534</link>
      <description>&lt;P&gt;Hello &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="260034" data-lia-user-login="foged" class="lia-mention lia-mention-user"&gt;foged&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the code you posted will not create this result. It will create a list with 4 items and each will get the value of the "months"-column. What exactly you need?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jimmy&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 05:33:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/List-Transform-referencing-column-returns-different-data/m-p/1386074#M43534</guid>
      <dc:creator>Jimmy801</dc:creator>
      <dc:date>2020-09-22T05:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: List.Transform referencing column returns different data</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/List-Transform-referencing-column-returns-different-data/m-p/1386097#M43536</link>
      <description>&lt;P&gt;Hi Jimmy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is the whole point - the value of "months" column is various from the rows of the table, not actually the value of the (ThisRow) parameter. I've narrowed it down by sorting the list from A-Z on the date column, which then produces the right results, but I've never had to do this before. Seems like a bug in Power BI desktop.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 05:46:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/List-Transform-referencing-column-returns-different-data/m-p/1386097#M43536</guid>
      <dc:creator>foged</dc:creator>
      <dc:date>2020-09-22T05:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: List.Transform referencing column returns different data</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/List-Transform-referencing-column-returns-different-data/m-p/1386240#M43540</link>
      <description>&lt;P&gt;Hello &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="260034" data-lia-user-login="foged" class="lia-mention lia-mention-user"&gt;foged&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try this code if now its working&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;let
Source = OData.Feed("....", null, [Implementation="2.0"]),
#"Add Custom" = Table.AddColumn(Source, "ReportDate", each [PeriodStart], type date),
#"Add Months" = Table.Buffer(Table.AddColumn(#"Add Custom", "Months", each (Duration.Days([PeriodEnd]-[PeriodStart])))),
#"MonthList" = Table.AddColumn(
#"Add Months", "DateList", 
(ThisRow) =&amp;gt; List.Transform(
{0..3}, 
each 
ThisRow[Months] )
, type list
)
in
MonthList&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt; or &lt;STRONG&gt;solves &lt;/STRONG&gt;your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)&lt;BR /&gt;Kudoes are nice too&lt;BR /&gt;&lt;BR /&gt;Have fun&lt;BR /&gt;&lt;BR /&gt;Jimmy&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 06:40:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/List-Transform-referencing-column-returns-different-data/m-p/1386240#M43540</guid>
      <dc:creator>Jimmy801</dc:creator>
      <dc:date>2020-09-22T06:40:30Z</dc:date>
    </item>
  </channel>
</rss>

