<?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 column is returning zero instead of value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-is-returning-zero-instead-of-value/m-p/3466302#M132297</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="518773" data-lia-user-login="lawadaa" class="lia-mention lia-mention-user"&gt;lawadaa&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Based on your description, I created some data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;You can try using the following calculated columns:&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;Column Percentage slaps = SWITCH(TRUE,
[achieve of overall]&amp;lt;0.9,"0%",
[achieve of overall]&amp;lt;0.95,"90%-94.9%",
[achieve of overall]&amp;lt;1.0,"95%-99.9%",
[achieve of overall]&amp;lt;1.05,"100%-104.9%",
[achieve of overall]&amp;lt;1.3,"120%-129.9%")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;It is important to note that the calculated column is not suitable for filtering, that is, the values in the calculated column are already calculated and do not change with the data, whereas the metric is filtered based on the context, and the value of the metric changes with the data, for example, in the example below a metric Measure Percentage slaps is created for the same dax:&lt;/P&gt;
&lt;P&gt;When the viusal value changes, the data in the calculated column does not become, the measure changes:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;You can check the following LINK for details:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/" target="_blank" rel="noopener"&gt;Calculated Columns and Measures in DAX - SQLBI&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If my answer doesn't meet your expectations, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.&amp;nbsp;We can better understand the problem and help you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An attachment for your reference. Hope it helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Community Support Team_ Scott Chang&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Oct 2023 07:30:40 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-10-09T07:30:40Z</dc:date>
    <item>
      <title>calculated column is returning zero instead of value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-is-returning-zero-instead-of-value/m-p/3463521#M132134</link>
      <description>&lt;P&gt;hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have created a calculate column that returns the percentage slap of a a measure. for example, if measure percentage = 120%, calculated column will return "120%-129%"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is the calculated column dax&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the output is always 0 for all measure[achiev of all] percentage values&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any idea how to fix the dax?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please note that i have to create calculated columnn and not measure since i want to use the column to join with another table&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 10:00:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-is-returning-zero-instead-of-value/m-p/3463521#M132134</guid>
      <dc:creator>lawadaa</dc:creator>
      <dc:date>2023-10-06T10:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: calculated column is returning zero instead of value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-is-returning-zero-instead-of-value/m-p/3463748#M132142</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="518773" data-lia-user-login="lawadaa" class="lia-mention lia-mention-user"&gt;lawadaa&lt;/a&gt;&amp;nbsp;Try writing a switch statement instead and remove the last "0%"(the one as result of false for last if).&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 12:15:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-is-returning-zero-instead-of-value/m-p/3463748#M132142</guid>
      <dc:creator>ChiragGarg2512</dc:creator>
      <dc:date>2023-10-06T12:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: calculated column is returning zero instead of value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-is-returning-zero-instead-of-value/m-p/3466302#M132297</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="518773" data-lia-user-login="lawadaa" class="lia-mention lia-mention-user"&gt;lawadaa&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Based on your description, I created some data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;You can try using the following calculated columns:&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;Column Percentage slaps = SWITCH(TRUE,
[achieve of overall]&amp;lt;0.9,"0%",
[achieve of overall]&amp;lt;0.95,"90%-94.9%",
[achieve of overall]&amp;lt;1.0,"95%-99.9%",
[achieve of overall]&amp;lt;1.05,"100%-104.9%",
[achieve of overall]&amp;lt;1.3,"120%-129.9%")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;It is important to note that the calculated column is not suitable for filtering, that is, the values in the calculated column are already calculated and do not change with the data, whereas the metric is filtered based on the context, and the value of the metric changes with the data, for example, in the example below a metric Measure Percentage slaps is created for the same dax:&lt;/P&gt;
&lt;P&gt;When the viusal value changes, the data in the calculated column does not become, the measure changes:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;You can check the following LINK for details:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/" target="_blank" rel="noopener"&gt;Calculated Columns and Measures in DAX - SQLBI&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If my answer doesn't meet your expectations, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.&amp;nbsp;We can better understand the problem and help you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An attachment for your reference. Hope it helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Community Support Team_ Scott Chang&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Oct 2023 07:30:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculated-column-is-returning-zero-instead-of-value/m-p/3466302#M132297</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-10-09T07:30:40Z</dc:date>
    </item>
  </channel>
</rss>

