<?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: Issue With Table Performance in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-With-Table-Performance/m-p/3345059#M125574</link>
    <description>&lt;P&gt;Hi again&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="434309" data-lia-user-login="eliasayyy" class="lia-mention lia-mention-user"&gt;eliasayyy&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for that &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;I'm thinking an acceptable solution may just be to only display the &lt;STRONG&gt;[new Price]&lt;/STRONG&gt; and &lt;STRONG&gt;[Final Price]&lt;/STRONG&gt;&amp;nbsp; measures if &lt;STRONG&gt;Sales&lt;/STRONG&gt; is nonempty.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The underlying issue is that the measures are based on &lt;STRONG&gt;Item&lt;/STRONG&gt; and &lt;STRONG&gt;Price Change&lt;/STRONG&gt; tables that are not filtered by &lt;STRONG&gt;Customer&lt;/STRONG&gt;, so will return a result for every &lt;STRONG&gt;Customer&lt;/STRONG&gt; when &lt;STRONG&gt;Customer Name&lt;/STRONG&gt; is included in the visual. We can restrict the combinations of Item/Customer by including only those combinations that occur in &lt;STRONG&gt;Sales&lt;/STRONG&gt;, by checking if &lt;STRONG&gt;Sales&lt;/STRONG&gt; is nonempty.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;new Price = 
IF (
    NOT ISEMPTY ( Sales ),
    MAX('Price Change'[Accumulated]) * MAX(Items[Item Price])
)&lt;/LI-CODE&gt;
&lt;P&gt;Note: Used COALESCE as alternative to IF.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Final Price = 
IF (
    NOT ISEMPTY (Sales ),
    VAR NewPrice = [new Price]
    RETURN
        COALESCE ( NewPrice, MAX ( Items[Item Price] ) )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does this or something similar work for you?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Updated PBIX attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Owen&lt;/P&gt;</description>
    <pubDate>Sun, 23 Jul 2023 05:44:26 GMT</pubDate>
    <dc:creator>OwenAuger</dc:creator>
    <dc:date>2023-07-23T05:44:26Z</dc:date>
    <item>
      <title>Issue With Table Performance</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-With-Table-Performance/m-p/3342776#M125476</link>
      <description>&lt;P&gt;I am building a sales table&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;when i add simple calculations i have a fast perfromance&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;as soon as i added "Price" it became very slow and sometime it give an error&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;my measure for price is&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;new Price = MAX('Price Change'[Accumulated]) * MAX(Items[Item Price])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;and the one used in the table&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Final Price = IF( [new Price] = BLANK() , CALCULATE(MAX(Items[Item Price])) , [new Price])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;here is my data model&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;so why is it affecting my perfromance?&lt;BR /&gt;&lt;BR /&gt;if it helps here i price change table&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;and the powerquery Code&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = Excel.Workbook(File.Contents("C:\Users\WorK\Desktop\Sales Report.xlsx"), null, true),
    #"Price Change_Sheet" = Source{[Item="Price Change",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(#"Price Change_Sheet", [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Date", type date}, {"Items ID", type text}, {"Price Change", Percentage.Type}}),
    #"Sorted Rows" = Table.Sort(#"Changed Type",{{"Date", Order.Ascending}}),
    #"Grouped Rows" = Table.Group(#"Sorted Rows", {"Items ID"}, {{"Table", each _, type table [Date=nullable date, Items ID=nullable text, Price Change=nullable number]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each let
    NewTable = [Table],
    Merged = Table.NestedJoin(NewTable, {"Date"}, Calendar, {"Date"}, "Calendar", JoinKind.FullOuter),
    ExpandedTable = Table.ExpandTableColumn(Merged, "Calendar", {"Date"}, {"Calendar Date"}),
    FilledDownTable = Table.FillDown(ExpandedTable, {"Items ID"}),
    FilledTable = Table.FillUp(FilledDownTable, {"Items ID"})
in 
    FilledTable),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Price Change", "Calendar Date"}, {"Price Change", "Calendar Date"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom",{{"Calendar Date", type date}, {"Price Change", Percentage.Type}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"Table"}),
    #"Sorted Rows1" = Table.Sort(#"Removed Columns",{{"Calendar Date", Order.Ascending}}),
    #"Grouped Rows1" = Table.Group(#"Sorted Rows1", {"Items ID"}, {{"Count", each _, type table [Items ID=nullable text, Price Change=nullable number, Calendar Date=nullable date]}}),
    #"Added Custom1" = Table.AddColumn(#"Grouped Rows1", "Custom", each let
    NewTable = [Count],
    Accumulated = List.Skip(List.Accumulate(
        NewTable[Price Change], {1},
        (st, cur) =&amp;gt; st &amp;amp; {List.Last(st) * (1 + (if cur = null then 0 else cur))}
    )),
    CombinedTable = Table.FromColumns({NewTable[Items ID], NewTable[Calendar Date], Accumulated}, {"Items ID", "Calendar Date", "Accumulated"})
in 
    CombinedTable),
    #"Expanded Custom1" = Table.ExpandTableColumn(#"Added Custom1", "Custom", {"Calendar Date", "Accumulated"}, {"Calendar Date", "Accumulated"}),
    #"Removed Columns1" = Table.RemoveColumns(#"Expanded Custom1",{"Count"}),
    #"Changed Type2" = Table.TransformColumnTypes(#"Removed Columns1",{{"Calendar Date", type date}, {"Accumulated", type number}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type2",{{"Calendar Date", "Date"}})
in
    #"Renamed Columns"&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;and the attached dataset&amp;nbsp;&lt;A href="https://1drv.ms/x/s!Ag9tIyk2ofNRlCPUFWLRgCkvroAZ?e=emRrTW" target="_blank" rel="nofollow noopener noreferrer"&gt;Sales Report.xlsx&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 07:56:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-With-Table-Performance/m-p/3342776#M125476</guid>
      <dc:creator>eliasayyy</dc:creator>
      <dc:date>2023-07-21T07:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Issue With Table Performance</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-With-Table-Performance/m-p/3344546#M125555</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="434309" data-lia-user-login="eliasayyy" class="lia-mention lia-mention-user"&gt;eliasayyy&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Would you be able to attach your PBIX file, or&amp;nbsp;could you post a single data model diagram showing all tables together?&lt;/LI&gt;
&lt;LI&gt;Which table contains the "&lt;STRONG&gt;Client Name&lt;/STRONG&gt;" column used in the visual?&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;My suspicion is that the cause of the issue is that, in the cases where &lt;STRONG&gt;new Price&lt;/STRONG&gt; is blank, &lt;STRONG&gt;Final Price&lt;/STRONG&gt; returns a value that depends only on the &lt;STRONG&gt;Items&lt;/STRONG&gt; dimension table. This could be a problem since, if any columns are included as "grouping columns" in the visual that do not filter the&amp;nbsp;&lt;STRONG&gt;Items&lt;/STRONG&gt;&amp;nbsp;table (such as possibly "&lt;STRONG&gt;Client Name&lt;/STRONG&gt;"), then all values of "&lt;STRONG&gt;Client Name&lt;/STRONG&gt;" will be displayed for each &lt;STRONG&gt;Item Name&amp;nbsp;&lt;/STRONG&gt;(roughly speaking a crossjoin of values of those two columns will return nonblank results and be shown in the visual).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The solution could be to apply some logic to limit the &lt;STRONG&gt;Client Name&lt;/STRONG&gt; &amp;amp; &lt;STRONG&gt;Item Name&lt;/STRONG&gt; combinations shown, for example by just showing Item/Client combinations that exist in the Sales table. It would be easier to answer with the PBIX file or more detail on the data model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's one idea you could try that limits &lt;STRONG&gt;Item ID &lt;/STRONG&gt;values&amp;nbsp;to just those existing in &lt;STRONG&gt;Sales&lt;/STRONG&gt;, but it would be good to see the full model diagram and possibly test in a copy of the PBIX.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also used ISBLANK rather than testing equality to BLANK ().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Final Price =
VAR NewPrice = [new Price]
RETURN
    IF (
        ISBLANK ( NewPrice ),
        CALCULATE (
            MAX ( Items[Item Price] ),
            -- only Items that exist in Sales based on other filters
            SUMMARIZE (
                Sales,
                Items[Item ID]
            )
        ),
        NewPrice
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jul 2023 04:51:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-With-Table-Performance/m-p/3344546#M125555</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2023-07-22T04:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Issue With Table Performance</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-With-Table-Performance/m-p/3344803#M125562</link>
      <description>&lt;P&gt;yes of course heres my pbix file&amp;nbsp;&lt;A href="https://1drv.ms/u/s!Ag9tIyk2ofNRlCY8yubOGYK-PGgZ?e=ShfeLi" target="_blank"&gt;Sales Presentation.pbix&lt;/A&gt;&lt;BR /&gt;and dataset&amp;nbsp;&lt;A href="https://1drv.ms/x/s!Ag9tIyk2ofNRlCWo4uODjZso0XVy?e=V1uMa4" target="_blank"&gt;Sales Report.xlsx&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jul 2023 14:39:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-With-Table-Performance/m-p/3344803#M125562</guid>
      <dc:creator>eliasayyy</dc:creator>
      <dc:date>2023-07-22T14:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: Issue With Table Performance</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-With-Table-Performance/m-p/3345059#M125574</link>
      <description>&lt;P&gt;Hi again&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="434309" data-lia-user-login="eliasayyy" class="lia-mention lia-mention-user"&gt;eliasayyy&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for that &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;I'm thinking an acceptable solution may just be to only display the &lt;STRONG&gt;[new Price]&lt;/STRONG&gt; and &lt;STRONG&gt;[Final Price]&lt;/STRONG&gt;&amp;nbsp; measures if &lt;STRONG&gt;Sales&lt;/STRONG&gt; is nonempty.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The underlying issue is that the measures are based on &lt;STRONG&gt;Item&lt;/STRONG&gt; and &lt;STRONG&gt;Price Change&lt;/STRONG&gt; tables that are not filtered by &lt;STRONG&gt;Customer&lt;/STRONG&gt;, so will return a result for every &lt;STRONG&gt;Customer&lt;/STRONG&gt; when &lt;STRONG&gt;Customer Name&lt;/STRONG&gt; is included in the visual. We can restrict the combinations of Item/Customer by including only those combinations that occur in &lt;STRONG&gt;Sales&lt;/STRONG&gt;, by checking if &lt;STRONG&gt;Sales&lt;/STRONG&gt; is nonempty.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;new Price = 
IF (
    NOT ISEMPTY ( Sales ),
    MAX('Price Change'[Accumulated]) * MAX(Items[Item Price])
)&lt;/LI-CODE&gt;
&lt;P&gt;Note: Used COALESCE as alternative to IF.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Final Price = 
IF (
    NOT ISEMPTY (Sales ),
    VAR NewPrice = [new Price]
    RETURN
        COALESCE ( NewPrice, MAX ( Items[Item Price] ) )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does this or something similar work for you?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Updated PBIX attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Owen&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jul 2023 05:44:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-With-Table-Performance/m-p/3345059#M125574</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2023-07-23T05:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Issue With Table Performance</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-With-Table-Performance/m-p/3345127#M125581</link>
      <description>&lt;P&gt;oh i get it now seems to make it faster thank you very much&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jul 2023 09:10:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-With-Table-Performance/m-p/3345127#M125581</guid>
      <dc:creator>eliasayyy</dc:creator>
      <dc:date>2023-07-23T09:10:31Z</dc:date>
    </item>
  </channel>
</rss>

