<?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: Need help with getting wrong data in the graph in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-getting-wrong-data-in-the-graph/m-p/3976747#M154187</link>
    <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;The issue with your solution is that I need to make it dynamically (not static).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;By changing the parametr, the graph should be updated. This is why the tables are created 'on the go' in the measure using dax. I have made the dax measure a little bit simplier and now it looks as follows:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;New Customers Sales **bleep** = 
VAR CustomerOrders = 
    SUMMARIZE(
        Orders,
        Orders[Klient_Nazwa],
        Orders[Data Zamówienia],
        "Year", YEAR(Orders[Data Zamówienia]),
        "TotalSales", SUM(Orders[Sprzedaż]),
        "TotalOrdersByClient", CALCULATE(DISTINCTCOUNT(Orders[ ID Zamówienia]), ALLEXCEPT(Orders, Orders[Klient_Nazwa]))
    )
	

Var CustomerOrdersFiltered = 
    FILTER(
        CustomerOrders, [TotalOrdersByClient] &amp;lt;= 'Customer Segmentation 2'[Customer Segmentation 2 Value])

Var CustomerOrdersFilteredGrouped = 
    GROUPBY(
        CustomerOrdersFiltered, [Year], 
        "SalesbyYear", SUMX(CURRENTGROUP(), [TotalSales]))

Var CustomerOrdersFinal = 
    ADDCOLUMNS(
        CustomerOrdersFilteredGrouped,
        "Rolling", SUMX(
            FILTER(
                CustomerOrdersFilteredGrouped,
                [Year] &amp;lt;= EARLIER([Year])
            ),
            [SalesbyYear]
        )
    )

Return SUMX(CustomerOrdersFinal, [Rolling])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;As the issue is with EARLIER function how I can replace it in this context in order to have Rolling sum for all previous years?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Updated file:&amp;nbsp;&lt;A href="https://drive.google.com/file/d/1ohuvV1ty35QdRZ9be5yZBf4Zn9GYsM7i/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/1ohuvV1ty35QdRZ9be5yZBf4Zn9GYsM7i/view?usp=sharing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jun 2024 10:04:15 GMT</pubDate>
    <dc:creator>Pk8524</dc:creator>
    <dc:date>2024-06-06T10:04:15Z</dc:date>
    <item>
      <title>Need help with getting wrong data in the graph</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-getting-wrong-data-in-the-graph/m-p/3973814#M154089</link>
      <description>&lt;P&gt;I am creating a dax measure called: "New Customers Sales Cumulative" which creates on the go a table&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;CustomerOrdersFinal which looks like this:&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;In the last line of code of this measure I refer to column Rolling, but when I am using this measure in the graph&lt;/DIV&gt;&lt;DIV&gt;it seems it takes data from SalesByYear:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;Why despite the fact that I am referring to rolling column, the graph takes data from SalesByYear?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;A href="https://drive.google.com/file/d/12sVJPAB-3xC1B8EWRoX5-uDKRFP3VxMo/view?usp=sharing" target="_self" rel="nofollow noopener noreferrer"&gt;https://drive.google.com/file/d/12sVJPAB-3xC1B8EWRoX5-uDKRFP3VxMo/view?usp=sharing&lt;/A&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 05 Jun 2024 09:59:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-getting-wrong-data-in-the-graph/m-p/3973814#M154089</guid>
      <dc:creator>Pk8524</dc:creator>
      <dc:date>2024-06-05T09:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with getting wrong data in the graph</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-getting-wrong-data-in-the-graph/m-p/3975776#M154161</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="754950" data-lia-user-login="Pk8524" class="lia-mention lia-mention-user"&gt;Pk8524&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Power BI visuals automatically aggregate and display data based on the available context and dimensions used in the visual.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The EARLIER function is context-dependent and may not work as expected in the function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An alternative available is to replace the fields in the chart with Year and Rolling from the New Customers Sales table.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The visual will look like this:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have any other questions please feel free to contact me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The pbix file is attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any 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;&amp;nbsp;to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 02:49:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-getting-wrong-data-in-the-graph/m-p/3975776#M154161</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-06T02:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with getting wrong data in the graph</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-getting-wrong-data-in-the-graph/m-p/3976747#M154187</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;The issue with your solution is that I need to make it dynamically (not static).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;By changing the parametr, the graph should be updated. This is why the tables are created 'on the go' in the measure using dax. I have made the dax measure a little bit simplier and now it looks as follows:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;New Customers Sales **bleep** = 
VAR CustomerOrders = 
    SUMMARIZE(
        Orders,
        Orders[Klient_Nazwa],
        Orders[Data Zamówienia],
        "Year", YEAR(Orders[Data Zamówienia]),
        "TotalSales", SUM(Orders[Sprzedaż]),
        "TotalOrdersByClient", CALCULATE(DISTINCTCOUNT(Orders[ ID Zamówienia]), ALLEXCEPT(Orders, Orders[Klient_Nazwa]))
    )
	

Var CustomerOrdersFiltered = 
    FILTER(
        CustomerOrders, [TotalOrdersByClient] &amp;lt;= 'Customer Segmentation 2'[Customer Segmentation 2 Value])

Var CustomerOrdersFilteredGrouped = 
    GROUPBY(
        CustomerOrdersFiltered, [Year], 
        "SalesbyYear", SUMX(CURRENTGROUP(), [TotalSales]))

Var CustomerOrdersFinal = 
    ADDCOLUMNS(
        CustomerOrdersFilteredGrouped,
        "Rolling", SUMX(
            FILTER(
                CustomerOrdersFilteredGrouped,
                [Year] &amp;lt;= EARLIER([Year])
            ),
            [SalesbyYear]
        )
    )

Return SUMX(CustomerOrdersFinal, [Rolling])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;As the issue is with EARLIER function how I can replace it in this context in order to have Rolling sum for all previous years?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Updated file:&amp;nbsp;&lt;A href="https://drive.google.com/file/d/1ohuvV1ty35QdRZ9be5yZBf4Zn9GYsM7i/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/1ohuvV1ty35QdRZ9be5yZBf4Zn9GYsM7i/view?usp=sharing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 10:04:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-with-getting-wrong-data-in-the-graph/m-p/3976747#M154187</guid>
      <dc:creator>Pk8524</dc:creator>
      <dc:date>2024-06-06T10:04:15Z</dc:date>
    </item>
  </channel>
</rss>

