<?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: Calculated measure DAX function in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-measure-DAX-function/m-p/3729723#M145324</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Based on your description, it appears that you are trying to calculate different counts of the number of weekly travel applications, taking into account various conditions. Let us solve your problem step-by-step.&lt;/P&gt;
&lt;P&gt;1. The ALLEXCEPT function removes all contextual filters from the table except those applied to the specified columns. Double check that this is consistent with your model logic.&lt;/P&gt;
&lt;P&gt;2. Your current filters do not appear to be correct. the VALUES function returns a single list of different values for the specified column. but you are comparing [WEEK_NO] and [DATE_OF_TRANSFER]. [DAY], which may not be compatible. You should ensure that you are comparing equivalent and related date components.&lt;/P&gt;
&lt;P&gt;3. Break the measure down into simpler parts and test each condition separately to ensure they work as expected. This helps to identify where the logic may be failing.&lt;/P&gt;
&lt;P&gt;Adjusted Dax Code Example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;INQ_TOUR_REQUEST_NO-2024 =
CALCULATE (
    DISTINCTCOUNT ( 'Append-QMR'[TOUR_REQUEST_NO] ),
    FILTER (
        'Append-QMR',
        'Append-QMR'[Year] = YEAR ( TODAY () )
            &amp;amp;&amp;amp; 'Append-QMR'[WEEK_NO] = MAX ( 'Append-QMR'[WEEK_NO] )
            &amp;amp;&amp;amp; 'Append-QMR'[TOUR_TYPE_KEY]
                IN VALUES ( M_TOUR_TYPE_D[TOUR_TYPE_KEY] )
                    &amp;amp;&amp;amp; 'Append-QMR'[DESTINATION_COUNTRY_KEY]
                        IN VALUES ( M_COUNTRY_D[COUNTRY_KEY] )
                            &amp;amp;&amp;amp; 'Append-QMR'[TERMINATION_DATE_KEY] IN VALUES ( M_DATE_D[DATE_KEY] )
    ),
    ALLEXCEPT ( 'M_DATE_WEEK_D', 'M_DATE_WEEK_D'[WEEK_NO] )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener"&gt;How to Get Your Question Answered Quickly - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired out put and pbix file without privacy information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Ada Wang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;Accept it as the solution&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Feb 2024 06:58:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-02-28T06:58:54Z</dc:date>
    <item>
      <title>Calculated measure DAX function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-measure-DAX-function/m-p/3716943#M144693</link>
      <description>&lt;P&gt;Hello team, Need help&lt;BR /&gt;&lt;BR /&gt;Iam&amp;nbsp; getting the difficult to create this dax function from the last week.&lt;BR /&gt;I have a table called Append-QMR in power bi report. For calculating Distinctcount of tour request numbers between week days for each week ..I have used below DAX measure&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;INQ_TOUR_REQUEST_NO-&lt;/SPAN&gt;&lt;SPAN&gt;2024&lt;/SPAN&gt;&lt;SPAN&gt; =&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INCT TOUR_REQUEST_NO) from s_spl_qmr_do_weekly_2024_f join m_date_d on INQUIRY_DATE_KEY = date_key where YEAR =2024 and FULL_DATE in (SELECT DATE_OF_TRANSFER from "DBA".M_DATE_WEEK_D where WEEK_NO= DATEPART(WEEK, GETDATE())-1)"&lt;BR /&gt;&lt;BR /&gt;and&amp;nbsp;in this INQUIRY_DATE_KEY from Append-QMR is related with DATE_KEY in M_DATE_D table..in M_DATE_D table we have FULL_DATE for every INQUIRY_DATE_KEY. and FULL_DATE column is related with DATE_OF_TRANSFER column in M_DATE_WEEK_D table by 1-1 relationship...This is the model.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;img /&gt;&lt;P&gt;for 8th week it should be 452 count.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;img /&gt;&lt;P&gt;this is my model&lt;/P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 22 Feb 2024 11:15:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-measure-DAX-function/m-p/3716943#M144693</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-22T11:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated measure DAX function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-measure-DAX-function/m-p/3718210#M144767</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>Thu, 22 Feb 2024 21:20:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-measure-DAX-function/m-p/3718210#M144767</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-02-22T21:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated measure DAX function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-measure-DAX-function/m-p/3729723#M145324</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Based on your description, it appears that you are trying to calculate different counts of the number of weekly travel applications, taking into account various conditions. Let us solve your problem step-by-step.&lt;/P&gt;
&lt;P&gt;1. The ALLEXCEPT function removes all contextual filters from the table except those applied to the specified columns. Double check that this is consistent with your model logic.&lt;/P&gt;
&lt;P&gt;2. Your current filters do not appear to be correct. the VALUES function returns a single list of different values for the specified column. but you are comparing [WEEK_NO] and [DATE_OF_TRANSFER]. [DAY], which may not be compatible. You should ensure that you are comparing equivalent and related date components.&lt;/P&gt;
&lt;P&gt;3. Break the measure down into simpler parts and test each condition separately to ensure they work as expected. This helps to identify where the logic may be failing.&lt;/P&gt;
&lt;P&gt;Adjusted Dax Code Example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;INQ_TOUR_REQUEST_NO-2024 =
CALCULATE (
    DISTINCTCOUNT ( 'Append-QMR'[TOUR_REQUEST_NO] ),
    FILTER (
        'Append-QMR',
        'Append-QMR'[Year] = YEAR ( TODAY () )
            &amp;amp;&amp;amp; 'Append-QMR'[WEEK_NO] = MAX ( 'Append-QMR'[WEEK_NO] )
            &amp;amp;&amp;amp; 'Append-QMR'[TOUR_TYPE_KEY]
                IN VALUES ( M_TOUR_TYPE_D[TOUR_TYPE_KEY] )
                    &amp;amp;&amp;amp; 'Append-QMR'[DESTINATION_COUNTRY_KEY]
                        IN VALUES ( M_COUNTRY_D[COUNTRY_KEY] )
                            &amp;amp;&amp;amp; 'Append-QMR'[TERMINATION_DATE_KEY] IN VALUES ( M_DATE_D[DATE_KEY] )
    ),
    ALLEXCEPT ( 'M_DATE_WEEK_D', 'M_DATE_WEEK_D'[WEEK_NO] )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener"&gt;How to Get Your Question Answered Quickly - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired out put and pbix file without privacy information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Ada Wang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;Accept it as the solution&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 06:58:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-measure-DAX-function/m-p/3729723#M145324</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-28T06:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated measure DAX function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-measure-DAX-function/m-p/3736095#M145623</link>
      <description>&lt;P&gt;Thanks for this, But How can I&amp;nbsp;&lt;SPAN&gt;Break the measure down into simpler parts&amp;nbsp;.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2024 10:38:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-measure-DAX-function/m-p/3736095#M145623</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-01T10:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated measure DAX function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-measure-DAX-function/m-p/3736265#M145629</link>
      <description>&lt;P&gt;Use variables for a step by step implementation.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2024 12:28:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-measure-DAX-function/m-p/3736265#M145629</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-03-01T12:28:49Z</dc:date>
    </item>
  </channel>
</rss>

