<?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 Calculating Standard Deviation for a Z-Score in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Standard-Deviation-for-a-Z-Score/m-p/4334984#M172117</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following calculation which calculates the standard deviation for the Sum of Extensive Peak Efforts for a day.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;STDEVX.P&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUMMARIZE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'MDGPS - MIP'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'MDGPS - MIP'&lt;/SPAN&gt;&lt;SPAN&gt;[Session Date]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'MDGPS - MIP'&lt;/SPAN&gt;&lt;SPAN&gt;[Extensive Peak Efforts]&lt;/SPAN&gt;&lt;SPAN&gt;)))&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;This DAX works fine but now when trying to apply this into a Z-Score calculation whereby it needs to ignore any date filters appied on my dashboard it does not work and shows 0. I have tried the following but unsure what else to try:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;STDEVX.P&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUMMARIZE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'MDGPS - MIP'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'MDGPS - MIP'&lt;/SPAN&gt;&lt;SPAN&gt;[Session Date]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'MDGPS - MIP'&lt;/SPAN&gt;&lt;SPAN&gt;[Extensive Peak Efforts]&lt;/SPAN&gt;&lt;SPAN&gt;), ALL('MDGPS - MIP'[Session Date])))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Dec 2024 11:44:16 GMT</pubDate>
    <dc:creator>Frasermc98</dc:creator>
    <dc:date>2024-12-18T11:44:16Z</dc:date>
    <item>
      <title>Calculating Standard Deviation for a Z-Score</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Standard-Deviation-for-a-Z-Score/m-p/4334984#M172117</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following calculation which calculates the standard deviation for the Sum of Extensive Peak Efforts for a day.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;STDEVX.P&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUMMARIZE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'MDGPS - MIP'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'MDGPS - MIP'&lt;/SPAN&gt;&lt;SPAN&gt;[Session Date]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'MDGPS - MIP'&lt;/SPAN&gt;&lt;SPAN&gt;[Extensive Peak Efforts]&lt;/SPAN&gt;&lt;SPAN&gt;)))&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;This DAX works fine but now when trying to apply this into a Z-Score calculation whereby it needs to ignore any date filters appied on my dashboard it does not work and shows 0. I have tried the following but unsure what else to try:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;STDEVX.P&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUMMARIZE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'MDGPS - MIP'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'MDGPS - MIP'&lt;/SPAN&gt;&lt;SPAN&gt;[Session Date]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'MDGPS - MIP'&lt;/SPAN&gt;&lt;SPAN&gt;[Extensive Peak Efforts]&lt;/SPAN&gt;&lt;SPAN&gt;), ALL('MDGPS - MIP'[Session Date])))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 11:44:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Standard-Deviation-for-a-Z-Score/m-p/4334984#M172117</guid>
      <dc:creator>Frasermc98</dc:creator>
      <dc:date>2024-12-18T11:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Standard Deviation for a Z-Score</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Standard-Deviation-for-a-Z-Score/m-p/4335240#M172138</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="581442" data-lia-user-login="Frasermc98" class="lia-mention lia-mention-user"&gt;Frasermc98&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The issue you're encountering likely arises from how filters are managed in your DAX formula. To ensure that the Z-Score calculation ignores any filters applied to [Session Date], the ALL function needs to be used properly to clear the filter context. You can modify your standard deviation formula as follows:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;STDEVX.P(
    SUMMARIZE(
        ALL('MDGPS - MIP'[Session Date]), 
        'MDGPS - MIP'[Session Date]
    ),
    CALCULATE(SUM('MDGPS - MIP'[Extensive Peak Efforts]))
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;This formula ensures that filters on [Session Date] are removed by using ALL('MDGPS - MIP'[Session Date]) within the SUMMARIZE function, creating a table of unique session dates that is unaffected by slicers. The CALCULATE function ensures the sum of [Extensive Peak Efforts] is evaluated in this filter-free context.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For the Z-Score calculation, you can construct the following formula:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Z-Score = 
VAR MeanEffort = AVERAGEX(
    ALL('MDGPS - MIP'[Session Date]), 
    CALCULATE(SUM('MDGPS - MIP'[Extensive Peak Efforts]))
)
VAR StdDevEffort = 
    STDEVX.P(
        SUMMARIZE(
            ALL('MDGPS - MIP'[Session Date]), 
            'MDGPS - MIP'[Session Date]
        ),
        CALCULATE(SUM('MDGPS - MIP'[Extensive Peak Efforts]))
    )
RETURN
DIVIDE(
    CALCULATE(SUM('MDGPS - MIP'[Extensive Peak Efforts])),
    StdDevEffort
) - MeanEffort
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;This formula calculates the mean and standard deviation of the extensive peak efforts across all session dates without being affected by dashboard filters. The MeanEffort variable computes the average effort by clearing the [Session Date] filter context, while StdDevEffort calculates the standard deviation in the same way. The Z-Score is then computed by dividing the sum of [Extensive Peak Efforts] by the standard deviation and subtracting the mean.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To troubleshoot, validate that your intermediate measures for mean and standard deviation are returning the correct values. Ensure that all necessary dates and efforts are included in your dataset and that no unintended filters or relationships are interfering with the calculation. If these steps are followed, your Z-Score calculation should work as intended, even when filters are applied on the dashboard.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 14:21:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Standard-Deviation-for-a-Z-Score/m-p/4335240#M172138</guid>
      <dc:creator>DataNinja777</dc:creator>
      <dc:date>2024-12-18T14:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Standard Deviation for a Z-Score</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Standard-Deviation-for-a-Z-Score/m-p/4336679#M172196</link>
      <description>&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Thanks for the reply from DataNinja777&amp;nbsp;, please allow me to provide another insight:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="581442" data-lia-user-login="Frasermc98" class="lia-mention lia-mention-user"&gt;Frasermc98&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Thanks for reaching out to the Microsoft fabric community forum.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt;" lang="zh-CN"&gt;Could you please let us know if DataNinja777's response resolved your issue? If it did, kindly accept it as the solution.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Since the first parameter of the STDEVX.P() function and the second parameter of the CALCULATE() function both require a table data type, it is necessary that the table you are using is already unfiltered. This is why the ALL() function is nested within SUMMARIZE().&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="zh-CN"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Of course, the ALLEXCEPT() function and REMOVEFILTERS are also functions that remove filters. Below is a screenshot of the relevant documentation:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="zh-CN"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;For more details, please refer to:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/all-function-dax" target="_blank"&gt;&lt;SPAN&gt;ALL function (DAX) - DAX | Microsoft Learn&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/allexcept-function-dax" target="_blank"&gt;&lt;SPAN&gt;ALLEXCEPT function (DAX) - DAX | Microsoft Learn&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/removefilters-function-dax" target="_blank"&gt;&lt;SPAN&gt;REMOVEFILTERS function (DAX) - DAX | Microsoft Learn&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;If the issue remains unresolved, we would appreciate it if you could provide sample data and the expected results so that we can better assist you in resolving the problem.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;.We recommend uploading it to GitHub and sharing the link with us.When uploading a file, please be careful to delete sensitive information.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;For questions about uploading data, you can try the following links:&lt;/P&gt;
&lt;P style="margin-top: 0pt; margin-bottom: 6pt;"&gt;&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;&lt;SPAN&gt;How to provide sample data in the Power BI Forum - Microsoft Fabric Community&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin-top: 0pt; margin-bottom: 6pt;"&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-upload-PBI-in-Community/m-p/1672886" target="_blank"&gt;&lt;SPAN&gt;Solved: How to upload PBI in Community - Microsoft Fabric Community&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin-top: 0pt; margin-bottom: 6pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-top: 0pt; margin-bottom: 6pt;"&gt;&lt;SPAN&gt;Of course, if you have any new discoveries or questions, please feel free to get in touch with us.&lt;BR /&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Leroy Lu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 10:01:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Standard-Deviation-for-a-Z-Score/m-p/4336679#M172196</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-19T10:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Standard Deviation for a Z-Score</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Standard-Deviation-for-a-Z-Score/m-p/4340812#M172374</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="581442" data-lia-user-login="Frasermc98" class="lia-mention lia-mention-user"&gt;Frasermc98&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to use ALL('MDGPS - MIP') to ignore all filters on the table.&lt;/P&gt;&lt;PRE&gt;STDEVX.P(&lt;BR /&gt;SUMMARIZE(&lt;BR /&gt;ALL('MDGPS - MIP'), &lt;BR /&gt;'MDGPS - MIP'[Session Date]&lt;BR /&gt;),&lt;BR /&gt;CALCULATE(SUM('MDGPS - MIP'[Extensive Peak Efforts]))&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":love_letter:"&gt;💌&lt;/span&gt; &lt;STRONG&gt;If this helped, a Kudos &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; or Solution mark &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; would be great! &lt;span class="lia-unicode-emoji" title=":party_popper:"&gt;🎉&lt;/span&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Cheers,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Kedar&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;A href="https://www.linkedin.com/in/kedar-pande" target="_blank" rel="noopener"&gt;Connect on LinkedIn&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 12:22:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Standard-Deviation-for-a-Z-Score/m-p/4340812#M172374</guid>
      <dc:creator>Kedar_Pande</dc:creator>
      <dc:date>2024-12-23T12:22:10Z</dc:date>
    </item>
  </channel>
</rss>

