<?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: Line Chart: Average of all Selected Lines during timestamp in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Line-Chart-Average-of-all-Selected-Lines-during-timestamp/m-p/3254934#M42841</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/552030"&gt;@josh122398&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my sample:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vjianbolimsft_1-1685090749552.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/920437i301D85C66AF58239/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vjianbolimsft_1-1685090749552.png" alt="vjianbolimsft_1-1685090749552.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Please try:&lt;/P&gt;
&lt;P&gt;First create a new table like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vc6xDcAwCETRXahdGDBJ2iRjWOy/hk1ko0txzZO+oHeSKkKF7jmu5CXlCTlQ3jmxLboqZZSo5CdRcUpblTWUqFRQorK8bvvDE+WrGkpUepH7AA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Year = _t, Legend = _t, Value = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Year", Int64.Type}, {"Legend", type text}, {"Value", Int64.Type}}),
    #"Removed Other Columns" = Table.SelectColumns(#"Changed Type",{"Legend"}),
    #"Removed Duplicates" = Table.Distinct(#"Removed Other Columns"),
    #"Added Custom" = Table.AddColumn(#"Removed Duplicates", "Custom", each {_[Legend],"Average"}),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom")
in
    #"Expanded Custom"&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vjianbolimsft_0-1685090706365.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/920435iEEC4DA1C407A602E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vjianbolimsft_0-1685090706365.png" alt="vjianbolimsft_0-1685090706365.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Then build relationship between the two tables:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vjianbolimsft_5-1685091360350.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/920443i818534DEDFD84CD5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vjianbolimsft_5-1685091360350.png" alt="vjianbolimsft_5-1685091360350.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Create a slicer:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vjianbolimsft_4-1685091348703.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/920442i184728FE35F2253F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vjianbolimsft_4-1685091348703.png" alt="vjianbolimsft_4-1685091348703.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Apply the measure to the line chart:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
VAR _a =
    ALLSELECTED ( 'Table'[Legend] )
RETURN
    IF (
        SELECTEDVALUE ( Legend[Custom] ) = "Average",
        CALCULATE (
            AVERAGE ( 'Table'[Value] ),
            FILTER (
                ALL ( 'Table' ),
                [Legend]
                    IN _a
                        &amp;amp;&amp;amp; [Year] = SELECTEDVALUE ( 'Table'[Year] )
            )
        ),
        SUM ( 'Table'[Value] )
    )
Measure =
VAR _a =
    ALLSELECTED ( 'Table'[Legend] )
RETURN
    IF (
        SELECTEDVALUE ( Legend[Custom] ) = "Average",
        CALCULATE (
            AVERAGE ( 'Table'[Value] ),
            FILTER (
                ALL ( 'Table' ),
                [Legend]
                    IN _a
                        &amp;amp;&amp;amp; [Year] = SELECTEDVALUE ( 'Table'[Year] )
            )
        ),
        SUM ( 'Table'[Value] )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vjianbolimsft_3-1685091338473.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/920441iF51735FB210E6415/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vjianbolimsft_3-1685091338473.png" alt="vjianbolimsft_3-1685091338473.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Final output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vjianbolimsft_2-1685091320555.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/920439iACA350815896A550/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vjianbolimsft_2-1685091320555.png" alt="vjianbolimsft_2-1685091320555.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jianbo Li&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Fri, 26 May 2023 08:56:53 GMT</pubDate>
    <dc:creator>v-jianboli-msft</dc:creator>
    <dc:date>2023-05-26T08:56:53Z</dc:date>
    <item>
      <title>Line Chart: Average of all Selected Lines during timestamp</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Line-Chart-Average-of-all-Selected-Lines-during-timestamp/m-p/3220481#M42529</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to keep an average of all selected lines (during each timestamp) on my line chart. However, I don't think PowerBI allows me to keep this curve due to the way legends interact with the data. See below what I mean:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the legend:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="josh122398_0-1683217218743.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/910554iA520453251640BED/image-size/medium?v=v2&amp;amp;px=400" role="button" title="josh122398_0-1683217218743.png" alt="josh122398_0-1683217218743.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Without the legend:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="josh122398_1-1683217241059.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/910555i834E45483796C20E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="josh122398_1-1683217241059.png" alt="josh122398_1-1683217241059.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In effect, I want the bottom curve (without the legend) overlayed with the top image's curves. Note, the curve without the legend&amp;nbsp;&lt;EM&gt;will&lt;/EM&gt; shift when I select/deselect the various legend values. I want this line to overlay with all unique legend values, and average the selected legend values when specified.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps describe my issue in enough depth.&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 16:23:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Line-Chart-Average-of-all-Selected-Lines-during-timestamp/m-p/3220481#M42529</guid>
      <dc:creator>josh122398</dc:creator>
      <dc:date>2023-05-04T16:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Line Chart: Average of all Selected Lines during timestamp</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Line-Chart-Average-of-all-Selected-Lines-during-timestamp/m-p/3223923#M42555</link>
      <description>&lt;P&gt;If this is important to you please consider voting for an existing idea or raising a new one at &lt;A href="https://ideas.powerbi.com" target="_blank"&gt;https://ideas.powerbi.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2023 00:48:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Line-Chart-Average-of-all-Selected-Lines-during-timestamp/m-p/3223923#M42555</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-05-08T00:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: Line Chart: Average of all Selected Lines during timestamp</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Line-Chart-Average-of-all-Selected-Lines-during-timestamp/m-p/3254934#M42841</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/552030"&gt;@josh122398&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my sample:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vjianbolimsft_1-1685090749552.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/920437i301D85C66AF58239/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vjianbolimsft_1-1685090749552.png" alt="vjianbolimsft_1-1685090749552.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Please try:&lt;/P&gt;
&lt;P&gt;First create a new table like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vc6xDcAwCETRXahdGDBJ2iRjWOy/hk1ko0txzZO+oHeSKkKF7jmu5CXlCTlQ3jmxLboqZZSo5CdRcUpblTWUqFRQorK8bvvDE+WrGkpUepH7AA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Year = _t, Legend = _t, Value = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Year", Int64.Type}, {"Legend", type text}, {"Value", Int64.Type}}),
    #"Removed Other Columns" = Table.SelectColumns(#"Changed Type",{"Legend"}),
    #"Removed Duplicates" = Table.Distinct(#"Removed Other Columns"),
    #"Added Custom" = Table.AddColumn(#"Removed Duplicates", "Custom", each {_[Legend],"Average"}),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom")
in
    #"Expanded Custom"&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vjianbolimsft_0-1685090706365.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/920435iEEC4DA1C407A602E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vjianbolimsft_0-1685090706365.png" alt="vjianbolimsft_0-1685090706365.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Then build relationship between the two tables:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vjianbolimsft_5-1685091360350.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/920443i818534DEDFD84CD5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vjianbolimsft_5-1685091360350.png" alt="vjianbolimsft_5-1685091360350.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Create a slicer:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vjianbolimsft_4-1685091348703.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/920442i184728FE35F2253F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vjianbolimsft_4-1685091348703.png" alt="vjianbolimsft_4-1685091348703.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Apply the measure to the line chart:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
VAR _a =
    ALLSELECTED ( 'Table'[Legend] )
RETURN
    IF (
        SELECTEDVALUE ( Legend[Custom] ) = "Average",
        CALCULATE (
            AVERAGE ( 'Table'[Value] ),
            FILTER (
                ALL ( 'Table' ),
                [Legend]
                    IN _a
                        &amp;amp;&amp;amp; [Year] = SELECTEDVALUE ( 'Table'[Year] )
            )
        ),
        SUM ( 'Table'[Value] )
    )
Measure =
VAR _a =
    ALLSELECTED ( 'Table'[Legend] )
RETURN
    IF (
        SELECTEDVALUE ( Legend[Custom] ) = "Average",
        CALCULATE (
            AVERAGE ( 'Table'[Value] ),
            FILTER (
                ALL ( 'Table' ),
                [Legend]
                    IN _a
                        &amp;amp;&amp;amp; [Year] = SELECTEDVALUE ( 'Table'[Year] )
            )
        ),
        SUM ( 'Table'[Value] )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vjianbolimsft_3-1685091338473.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/920441iF51735FB210E6415/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vjianbolimsft_3-1685091338473.png" alt="vjianbolimsft_3-1685091338473.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Final output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vjianbolimsft_2-1685091320555.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/920439iACA350815896A550/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vjianbolimsft_2-1685091320555.png" alt="vjianbolimsft_2-1685091320555.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jianbo Li&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 08:56:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Line-Chart-Average-of-all-Selected-Lines-during-timestamp/m-p/3254934#M42841</guid>
      <dc:creator>v-jianboli-msft</dc:creator>
      <dc:date>2023-05-26T08:56:53Z</dc:date>
    </item>
  </channel>
</rss>

