<?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: DAX Query in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Query/m-p/4035843#M159933</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="449986" data-lia-user-login="Sri57" class="lia-mention lia-mention-user"&gt;Sri57&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description, here are my steps you can follow as a solution.&lt;/P&gt;
&lt;P&gt;(1) We can create a measure.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;avg = 
var _count=COUNTROWS(ALLSELECTED('Table'))
var _nr=SUMX(ALLSELECTED('Table'),[NR])
RETURN DIVIDE(_nr,_count)&lt;/LI-CODE&gt;
&lt;P&gt;(2) Then the result is as follows.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If the above one can't help you get the desired result, please provide some&amp;nbsp;&lt;STRONG&gt;sample data&lt;/STRONG&gt;&amp;nbsp;in your tables (&lt;STRONG&gt;exclude&amp;nbsp;sensitive&amp;nbsp;data&lt;/STRONG&gt;) with&amp;nbsp;&lt;STRONG&gt;Text&lt;/STRONG&gt;&amp;nbsp;format and your&amp;nbsp;&lt;STRONG&gt;expected result&lt;/STRONG&gt;&amp;nbsp;with backend logic and special examples.&amp;nbsp;&lt;STRONG&gt;It is better&lt;/STRONG&gt;&amp;nbsp;if you can share a&amp;nbsp;&lt;STRONG&gt;simplified&lt;/STRONG&gt;&amp;nbsp;pbix file.&amp;nbsp;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post  &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution &lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jul 2024 01:59:21 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-07-11T01:59:21Z</dc:date>
    <item>
      <title>DAX Query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Query/m-p/4033294#M159655</link>
      <description>&lt;P&gt;Hello Experts,&lt;BR /&gt;I want to calculate average of a measure NR:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;NR=VAR CurrentDate = MAX('Dim - Calendar'[Fiscal Year ID])


VAR result =
    CALCULATE(
        COUNTROWS('Audit'),
        FILTER(
            ALLEXCEPT('Audit', 'Audit'[NAME]),
            'Audit'[RATING] = "Needs Refinement" &amp;amp;&amp;amp;
            
            'Audit'[FISCAL_YEAR_ID] = CurrentDate
        ),
        CROSSFILTER('Dim - Calendar'[Date], 'Audit'[PLANNED_START], None)
    )

VAR max_notblank =
    CALCULATE(
        MAX('Audit'[FISCAL_YEAR_ID]),
        FILTER(
            ALLSELECTED('Audit'),
            'Audit'[FISCAL_YEAR_ID] &amp;lt; CurrentDate ||
            
            'Audit'[FISCAL_YEAR_ID] &amp;lt;&amp;gt; BLANK()
        ),
        CROSSFILTER('Dim - Calendar'[Date], 'Audit'[PLANNED_START], None)
    )

VAR result1 =
    CALCULATE(
        COUNTROWS('Audit'),
        FILTER(
            ALLEXCEPT('Audit', 'Audit'[NAME]),
            'Audit'[RATING] = "Needs Refinement" &amp;amp;&amp;amp;
            
             'Audit'[FISCAL_YEAR_ID] = max_notblank)
        ),
        CROSSFILTER('Dim - Calendar'[Date], 'Audit'[ENGAGEMENT_PLANNED_START], None)
    )
if(result = blank(),result1,result)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; for this I have written averagex(values(Audit[Name]),[NR]),&lt;BR /&gt;here it is getting only result value, eeven I have data for previous year for other names.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;here for the selected year we only have data for one name, but as per my measureNR, we have 5 records as it is checking previous year too.now I want average of NRlike(6+4+5+10+11)/5=7.2. As averagex is not working I tried to create two different measures like(sumof NR/countof NR),I succeded in creating sum of NR measure but not count of NR&lt;BR /&gt;&lt;BR /&gt;please help&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 00:28:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Query/m-p/4033294#M159655</guid>
      <dc:creator>Sri57</dc:creator>
      <dc:date>2024-07-10T00:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Query/m-p/4035843#M159933</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="449986" data-lia-user-login="Sri57" class="lia-mention lia-mention-user"&gt;Sri57&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description, here are my steps you can follow as a solution.&lt;/P&gt;
&lt;P&gt;(1) We can create a measure.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;avg = 
var _count=COUNTROWS(ALLSELECTED('Table'))
var _nr=SUMX(ALLSELECTED('Table'),[NR])
RETURN DIVIDE(_nr,_count)&lt;/LI-CODE&gt;
&lt;P&gt;(2) Then the result is as follows.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If the above one can't help you get the desired result, please provide some&amp;nbsp;&lt;STRONG&gt;sample data&lt;/STRONG&gt;&amp;nbsp;in your tables (&lt;STRONG&gt;exclude&amp;nbsp;sensitive&amp;nbsp;data&lt;/STRONG&gt;) with&amp;nbsp;&lt;STRONG&gt;Text&lt;/STRONG&gt;&amp;nbsp;format and your&amp;nbsp;&lt;STRONG&gt;expected result&lt;/STRONG&gt;&amp;nbsp;with backend logic and special examples.&amp;nbsp;&lt;STRONG&gt;It is better&lt;/STRONG&gt;&amp;nbsp;if you can share a&amp;nbsp;&lt;STRONG&gt;simplified&lt;/STRONG&gt;&amp;nbsp;pbix file.&amp;nbsp;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post  &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution &lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 01:59:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Query/m-p/4035843#M159933</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-11T01:59:21Z</dc:date>
    </item>
  </channel>
</rss>

