<?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: Can some one help me speed up my dax queries .. loading time is too long in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-some-one-help-me-speed-up-my-dax-queries-loading-time-is-too/m-p/3767829#M147124</link>
    <description>&lt;P&gt;anything more specific based on my queries?&lt;/P&gt;</description>
    <pubDate>Sat, 16 Mar 2024 04:07:24 GMT</pubDate>
    <dc:creator>spradhan_pm</dc:creator>
    <dc:date>2024-03-16T04:07:24Z</dc:date>
    <item>
      <title>Can some one help me speed up my dax queries .. loading time is too long</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-some-one-help-me-speed-up-my-dax-queries-loading-time-is-too/m-p/3767063#M147098</link>
      <description>&lt;P&gt;i have a huge amount of data about 2.6 million rows..&lt;BR /&gt;i need to reduce&amp;nbsp;the loading time.. cuz it takes more than a minute to load&lt;BR /&gt;&lt;BR /&gt;the&amp;nbsp; dax measures that calculate starting count ( count_min) and ending count( count_max ) and turnover&amp;nbsp; for multiple values .. but it takes too long to execute&lt;BR /&gt;&lt;BR /&gt;the huge date is split into multiple different tables and a distinct user table as fact table..&lt;BR /&gt;the different tables have data based on date&amp;nbsp;&lt;BR /&gt;and i need to calculate the values for each table in a specific point in time .. which requires searching each table and getting the max date before the specific date and this same logic need to be done for each table and i have atleast 5 diff tables where i need to get the data from..&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;this is one of many main measures for the count at starting date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;count_min =


    var SelectedMaxDate =
        // Min('Calendar'[Date])
        [relative_date_min]
        //  DATE(2024,2,31)

       
    var selectedDealer =
        Values('Dealer/District/Zone/Region_Lookup'[DealerID])
//    SELECTEDVALUE('Dealer/District/Zone/Region_Lookup'[DealerID])
    //  "10130"

   
    var selectedJob =
        Values(Job_Lookup[JobID])
//    SELECTEDVALUE(Job_Lookup[JobID])
        // "D102"
       
    var selectedTenure =
        Values(TenureSort_Reference[TenureSort])

   
    var selectedDriveR =
        Values(DriveReimbursement_Shadow[DriveParticipation])


RETURN
calculate(
    SUMX(
        'User_Shadow',
       CALCULATE (
            COUNTX(
                FILTER(
                    User_Shadow,
                    // Calculation_shadow[latestJob_min] = Maxx(RELATEDTABLE(Job_Shadow),Job_Shadow[PRIMARY_JOB_CD])  &amp;amp;&amp;amp;
                    //  Calculation_shadow[latestDealer_min] = Maxx(RELATEDTABLE(Dealer_Shadow),Dealer_Shadow[DLR_CD])
                    // &amp;amp;&amp;amp;  
                    Calculation_shadow[latestDealer_min] in selectedDealer
                    &amp;amp;&amp;amp; Calculation_shadow[latestJob_min] in selectedJob
                    &amp;amp;&amp;amp; Calculation_shadow[latestTenure_min] in selectedTenure
                    &amp;amp;&amp;amp; Calculation_shadow[latestDriveR_min] in selectedDriveR
                   
                    &amp;amp;&amp;amp;
                     NOT(Calculation_shadow[latestJob_min]  IN {"D345", "D346", "D347", "D365", "D366", "D367"})
                    &amp;amp;&amp;amp; LEFT(Calculation_shadow[latestJob_min], 1) = "D"
                   
                   


                    &amp;amp;&amp;amp;
                //    ( LatestHireBeforeSelectedDate = Calculation_shadow[latestHire_min]
                //     &amp;amp;&amp;amp; Calculation_shadow[latestHire_min]  &amp;lt;= SelectedMaxDate )
                    Calculation_shadow[latestHire_min]  &amp;lt;= SelectedMaxDate
                    &amp;amp;&amp;amp; (
                        ISBLANK(Calculation_shadow[latestFire_min])
                        || (
                            // Calculation_shadow[latestFire_min] &amp;lt;= SelectedMaxDate
                            // &amp;amp;&amp;amp;
                             Not(DATEVALUE(Calculation_shadow[latestFire_min]) &amp;gt; DATEVALUE(Calculation_shadow[latestHire_min] ))

                            )
                           
                    )
                ),
                // DISTINCT(User_Shadow[ExternalCode])
                User_Shadow[ExternalCode]
            )
           
            ,CROSSFILTER(
                'Job_Lookup'[JobID],
                Job_Shadow[PRIMARY_JOB_CD]
                ,None
            )
            ,CROSSFILTER(
                'Dealer/District/Zone/Region_Lookup'[DealerID],
                Dealer_Shadow[DLR_CD]
                ,None
            )
        )
    )

) +0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Everything referenced from Calculation_shadow is a measure with similar logic to this one below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;latestJob_max = 

    var SelectedMaxDate = 
    // MAX('Calendar'[Date])
    [relative_date_max]
    
VAR MaxDateBefore = 
    CALCULATE(
        MAX(Job_Shadow[umd_date]), 
        ALL(Job_Shadow[umd_date],Job_Shadow[PRIMARY_JOB_CD]), // This removes filters only from umd_date and ExternalCode
        // Job_Shadow[ExternalCode] = "D00031301",
        Job_Shadow[umd_date] &amp;lt; SelectedMaxDate,
        REMOVEFILTERS(Job_Lookup)
    )

VAR Result = 
    CALCULATE(
        MAX(Job_Shadow[PRIMARY_JOB_CD]),
        Job_Shadow[PRIMARY_JOB_CD] in VALUES(Job_Lookup[JobID]),
        // ALLEXCEPT(Job_Shadow, Job_Shadow[SomeOtherColumn]), // Keeps filters on SomeOtherColumn, adjust as necessary
        // Job_Shadow[ExternalCode] = "D00031301",
        Job_Shadow[umd_date] = MaxDateBefore
    )

RETURN
    Result
   &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;count_terminated_range = 


    var SelectedMaxDate = 
		// Max('Calendar'[Date])
        [relative_date_max]
    var SelectedMinDate = 
        [relative_date_min]
		// Min('Calendar'[Date])
		//  DATE(2024,2,31)

		
	var selectedDealer = 
        Values('Dealer/District/Zone/Region_Lookup'[DealerID])
//    SELECTEDVALUE('Dealer/District/Zone/Region_Lookup'[DealerID])
    //  "10130"

    
	var selectedJob = 
        Values(Job_Lookup[JobID])
//    SELECTEDVALUE(Job_Lookup[JobID])
		// "D102"
		

        
		
	var selectedTenure = 
        Values(TenureSort_Reference[TenureSort])

    
	var selectedDriveR = 
        Values(DriveParticipation_Lookup[Column1])
        
return
calculate(
    SUMX(
        'User_Shadow',
       CALCULATE (
            COUNTX(
                FILTER(
                    User_Shadow,
                    // ( Calculation_shadow[latestDealer_min] in selectedDealer || Calculation_shadow[latestDealer_max] in selectedDealer )
                    // &amp;amp;&amp;amp; ( Calculation_shadow[latestJob_min] in selectedJob || Calculation_shadow[latestJob_max] in selectedJob)
                    // &amp;amp;&amp;amp;
                    // ( Calculation_shadow[latestTenure_min] in selectedTenure || Calculation_shadow[latestTenure_max] in selectedTenure)
                    // &amp;amp;&amp;amp; ( Calculation_shadow[latestDriveR_min] in selectedDriveR || Calculation_shadow[latestDriveR_max] in selectedDriveR)
                    

                     [latestJob_max] in selectedJob
                    &amp;amp;&amp;amp; [latestTenure_max] in selectedTenure
                    &amp;amp;&amp;amp; [latestDriveR_max] in selectedDriveR
                    
                    &amp;amp;&amp;amp; NOT(Calculation_shadow[latestJob_max]  IN {"D345", "D346", "D347", "D365", "D366", "D367"})
                    &amp;amp;&amp;amp; LEFT(Calculation_shadow[latestJob_max], 1) = "D"
                    
//                 	&amp;amp;&amp;amp; 
//                 	[latestJob] in   VALUES(RELATEDTABLE(Job_Lookup))[JobID]
                    
                    &amp;amp;&amp;amp;

                    
                    (
                        (
                            Not(ISBLANK([latestFire_max]))
                            &amp;amp;&amp;amp;  (

                                [latestDealer_max] in selectedDealer 
                                &amp;amp;&amp;amp; SelectedMinDate &amp;lt;= Calculation_shadow[latestFire_max] 
                                &amp;amp;&amp;amp;  Calculation_shadow[latestFire_max] &amp;lt; SelectedMaxDate
                                &amp;amp;&amp;amp; 
                                //    not( 
                                    // DATEVALUE(Calculation_shadow[latestFire_max]) &amp;lt;= DATEVALUE(Calculation_shadow[latestHire_max])
                                    
                                //    )
                                    // DATEVALUE(Calculation_shadow[latestFire_max]) &amp;gt; DATEVALUE(Calculation_shadow[latestHire_max])
                                    // INT(Calculation_shadow[latestFire_max]) &amp;gt; INT(Calculation_shadow[latestHire_max])


                                    format(Calculation_shadow[latestFire_max] , "YYYYMMDD") &amp;gt; format(Calculation_shadow[latestHire_max] , "YYYYMMDD")
                                // &amp;amp;&amp;amp; NOT(DATEVALUE(Calculation_shadow[latestFire_max]) = DATEVALUE(Calculation_shadow[latestHire_max]))

                            )
                            
                            
                            
                        )
                         || 
                        (
                             HASONEVALUE('Dealer/District/Zone/Region_Lookup'[DealerID])
                            &amp;amp;&amp;amp; [latestDealer_min] in selectedDealer
                            &amp;amp;&amp;amp; Not( [latestDealer_max] = [latestDealer_min] )
                            
                        )
                    )

                    
                    
                    // 'Hire_Shadow'[TRMNTN_DT] &amp;gt;= SelectedMinDate
                    // &amp;amp;&amp;amp; 'Hire_Shadow'[TRMNTN_DT] &amp;lt;= SelectedMaxDate
                ),
                User_Shadow[ExternalCode]
            )
            
		    ,CROSSFILTER(
		        'Job_Lookup'[JobID],
		        Job_Shadow[PRIMARY_JOB_CD]
		        ,None
		    )
		    ,CROSSFILTER(
		        'Dealer/District/Zone/Region_Lookup'[DealerID],
		        Dealer_Shadow[DLR_CD]
		        ,None
		    )
        )
    )
    // ,CROSSFILTER(
    //     'Calendar'[Date],
    //     Hire_Shadow[HIRE_DATE]
    //     ,None
    // )
) +0



    &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;count_avgEmp = DIVIDE([count_min] + [count_max],2,0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;turnover_master = 
    DIVIDE([count_terminated_range], [count_avgEmp], 0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;where im having the most lag time is creating a line chart for each month to get turnover which includes calculating count_min and count_max(similar logic but with max date) and count_terminated_range..&lt;BR /&gt;any way to fix the load time ?&lt;/P&gt;&lt;P&gt;or reduce the data to be processed ?&lt;/P&gt;&lt;P&gt;or any solutions .. to tackle my issue ?&lt;BR /&gt;any help is appreciated thanks&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 15:36:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-some-one-help-me-speed-up-my-dax-queries-loading-time-is-too/m-p/3767063#M147098</guid>
      <dc:creator>spradhan_pm</dc:creator>
      <dc:date>2024-03-15T15:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Can some one help me speed up my dax queries .. loading time is too long</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-some-one-help-me-speed-up-my-dax-queries-loading-time-is-too/m-p/3767341#M147107</link>
      <description>&lt;P&gt;- Install DAX Studio&lt;/P&gt;
&lt;P&gt;- learn how to use it to optimize queries (videos on SQLBI.com)&lt;/P&gt;
&lt;P&gt;- examine your queries and refactor them based on your findings.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 17:57:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-some-one-help-me-speed-up-my-dax-queries-loading-time-is-too/m-p/3767341#M147107</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-03-15T17:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: Can some one help me speed up my dax queries .. loading time is too long</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-some-one-help-me-speed-up-my-dax-queries-loading-time-is-too/m-p/3767829#M147124</link>
      <description>&lt;P&gt;anything more specific based on my queries?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Mar 2024 04:07:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-some-one-help-me-speed-up-my-dax-queries-loading-time-is-too/m-p/3767829#M147124</guid>
      <dc:creator>spradhan_pm</dc:creator>
      <dc:date>2024-03-16T04:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Can some one help me speed up my dax queries .. loading time is too long</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-some-one-help-me-speed-up-my-dax-queries-loading-time-is-too/m-p/3768637#M147165</link>
      <description>&lt;P&gt;Please provide sample data that covers your issue or question &lt;STRONG&gt;completely&lt;/STRONG&gt;, in a &lt;STRONG&gt;usable&lt;/STRONG&gt; format (not as a screenshot).&lt;BR /&gt;&lt;BR /&gt;Do not include sensitive information or anything not related to the issue or question. &lt;BR /&gt;&lt;BR /&gt;If you are unsure how to upload data please refer to &lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;Want faster answers? &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Mar 2024 11:29:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-some-one-help-me-speed-up-my-dax-queries-loading-time-is-too/m-p/3768637#M147165</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-03-16T11:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Can some one help me speed up my dax queries .. loading time is too long</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-some-one-help-me-speed-up-my-dax-queries-loading-time-is-too/m-p/3781976#M147748</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="692532" data-lia-user-login="spradhan_pm" class="lia-mention lia-mention-user"&gt;spradhan_pm&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;The direction lbendlin&amp;nbsp;provided was pretty good, and his dedication was much appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Improve the efficiency of your data model by:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Removing unnecessary columns&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Remove unnecessary rows&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. Grouping basis and aggregation&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. Optimizing column data types&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5. Customizing column preferences&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;6. Disable Power Query query load&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;7. Disable automatic date/time&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;8. Switch to mixed mode&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;More related information can be found in:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/guidance/import-modeling-data-reduction" target="_blank"&gt;Data reduction techniques for Import modeling - Power BI | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there are calculated columns in the model, please consider moving these to Power Query when possible, as calculated columns increase the size of the model and slow down the refresh time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also use Performance Analyzer to see which visual objects take the longest to load and which DAX queries take the longest.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For more information about Performance Analyzer see:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-performance-analyzer" target="_blank"&gt;Use Performance Analyzer to examine report element performance in Power BI Desktop - Power BI | Microsoft Learn&lt;/A&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;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, 21 Mar 2024 08:12:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-some-one-help-me-speed-up-my-dax-queries-loading-time-is-too/m-p/3781976#M147748</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-21T08:12:59Z</dc:date>
    </item>
  </channel>
</rss>

