<?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: Power Query: Group Value In Period. in Power Query</title>
    <link>https://community.fabric.microsoft.com/t5/Power-Query/Power-Query-Group-Value-In-Period/m-p/1938265#M57166</link>
    <description>&lt;P&gt;I query from xls files (or table), not SQL server use PowerQuery in Excel, not Power BI&lt;/P&gt;</description>
    <pubDate>Mon, 05 Jul 2021 14:52:40 GMT</pubDate>
    <dc:creator>trungduc_acc</dc:creator>
    <dc:date>2021-07-05T14:52:40Z</dc:date>
    <item>
      <title>Power Query: Group Value In Period.</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Power-Query-Group-Value-In-Period/m-p/1938183#M57161</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;I have Query 1 and Query 2 as&amp;nbsp;below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I want group text in #"Query 1"[Value] Column by period in #"Query 2". Result as below:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Please, help me! Thank you very much.&lt;/P&gt;&lt;P&gt;Link Data File:&amp;nbsp;&lt;A href="https://1drv.ms/x/s!AjR7DINn-uTQgpsC-UicRFc1kEUxWA?e=OsT31r" target="_blank" rel="noopener"&gt;https://1drv.ms/x/s!AjR7DINn-uTQgpsC-UicRFc1kEUxWA?e=OsT31r&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 13:57:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Power-Query-Group-Value-In-Period/m-p/1938183#M57161</guid>
      <dc:creator>trungduc_acc</dc:creator>
      <dc:date>2021-07-05T13:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: Power Query: Group Value In Period.</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Power-Query-Group-Value-In-Period/m-p/1938213#M57164</link>
      <description>&lt;P&gt;Are you getting it from a SQL server? It is much easier to this on a Sql-Server side. Please provide some insight on the data source you are querying it from. If it can be done natively, you don't need to be bothered about power query doing this job for you.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 14:16:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Power-Query-Group-Value-In-Period/m-p/1938213#M57164</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2021-07-05T14:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Power Query: Group Value In Period.</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Power-Query-Group-Value-In-Period/m-p/1938265#M57166</link>
      <description>&lt;P&gt;I query from xls files (or table), not SQL server use PowerQuery in Excel, not Power BI&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 14:52:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Power-Query-Group-Value-In-Period/m-p/1938265#M57166</guid>
      <dc:creator>trungduc_acc</dc:creator>
      <dc:date>2021-07-05T14:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Power Query: Group Value In Period.</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Power-Query-Group-Value-In-Period/m-p/1938665#M57177</link>
      <description>&lt;P&gt;You would need a calendar table for this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/*_fact1*/

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtQ1ACElHSjHSNfQVClWJxrBNUOSM7JQio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [from = _t, to = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"from", type date}, {"to", type date}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type),
    #"Reordered Columns" = Table.ReorderColumns(#"Added Index",{"Index", "from", "to"}),
    #"Added Custom" = Table.AddColumn(#"Reordered Columns", "Custom", each {Number.From([from])..Number.From([to])}),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom",{{"Custom", type date}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type1", {"Custom"}, _fact2, {"dates"}, "_fact2", JoinKind.LeftOuter),
    #"Expanded _fact2" = Table.ExpandTableColumn(#"Merged Queries", "_fact2", {"value"}, {"value"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded _fact2", each ([value] &amp;lt;&amp;gt; null)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Custom"}),
    #"Grouped Rows" = Table.Group(#"Removed Columns", {"Index", "from", "to"}, {{"ad", each _, type table [Index=number, from=nullable date, to=nullable date, value=nullable text]}}),
    #"Added Custom1" = Table.AddColumn(#"Grouped Rows", "Custom", each let x =[ad],
    #"Removed Columns1" = Table.RemoveColumns(x,{"Index", "from", "to"}),
    value = #"Removed Columns1"[value]
in
    value),
    #"Removed Columns2" = Table.RemoveColumns(#"Added Custom1",{"ad"}),
    #"Extracted Values" = Table.TransformColumns(#"Removed Columns2", {"Custom", each Text.Combine(List.Transform(_, Text.From), ","), type text})
in
    #"Extracted Values"
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/*_fact2*/
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtQ1ACElHSVHpVgdJCFjoJATqpAJUMgZScgIiIBCLihCRhZAIVdUITOgkJtSbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [dates = _t, value = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"dates", type date}, {"value", type text}})
in
    #"Changed Type"&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;/*calendar*/
let
    Source = {44197..44562},
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Date.From([Column1]))
in
    #"Added Custom"&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 05 Jul 2021 19:36:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Power-Query-Group-Value-In-Period/m-p/1938665#M57177</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2021-07-05T19:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: Power Query: Group Value In Period.</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Power-Query-Group-Value-In-Period/m-p/1938788#M57183</link>
      <description>&lt;P&gt;Thank you very much @smpa01&lt;/P&gt;&lt;P&gt;Your solution is perfect. That's really what I need. Allow me to modify it a bit. Delete add index step and all step after GroupBy step in /*_fact1*/ as bellow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/*_fact1*/
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtQ1ACElHSjHSNfQVClWJxrBNUOSM7JQio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [from = _t, to = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"from", type date}, {"to", type date}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each {Number.From([from])..Number.From([to])}),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom",{{"Custom", type date}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type1", {"Custom"}, _fact2, {"dates"}, "_fact2", JoinKind.LeftOuter),
    #"Expanded _fact2" = Table.ExpandTableColumn(#"Merged Queries", "_fact2", {"value"}, {"value"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded _fact2", each ([value] &amp;lt;&amp;gt; null)),
    #"Grouped Rows" = Table.Group(#"Filtered Rows", {"from", "to"}, {{"Value", each Text.Combine([value],","), type text}})
in
    #"Grouped Rows"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Number of step less than but is it's performance better than? I don't know.&lt;/P&gt;&lt;P&gt;Query /*calendar*/ in your solution. what does it use? I don't know, too. I only use /*_fact1*/ and&amp;nbsp;/*_fact2*/.&lt;/P&gt;&lt;P&gt;Thanks again&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="24978" data-lia-user-login="smpa01" class="lia-mention lia-mention-user"&gt;smpa01&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 22:47:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Power-Query-Group-Value-In-Period/m-p/1938788#M57183</guid>
      <dc:creator>trungduc_acc</dc:creator>
      <dc:date>2021-07-05T22:47:08Z</dc:date>
    </item>
  </channel>
</rss>

