<?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 Replacing blank with 0 with a condition in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2400688#M62801</link>
    <description>&lt;P&gt;So I have a chart that displays a count in the Y axxis and the time in the X axxis and I want to replace the blank values with zeros but only when the month already passed or if it is the month we are in.&lt;BR /&gt;&lt;BR /&gt;Chart with blank values:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Chart with zeros:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Chart that I need:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Mar 2022 13:09:42 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-03-17T13:09:42Z</dc:date>
    <item>
      <title>Replacing blank with 0 with a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2400688#M62801</link>
      <description>&lt;P&gt;So I have a chart that displays a count in the Y axxis and the time in the X axxis and I want to replace the blank values with zeros but only when the month already passed or if it is the month we are in.&lt;BR /&gt;&lt;BR /&gt;Chart with blank values:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Chart with zeros:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Chart that I need:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2022 13:09:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2400688#M62801</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-17T13:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank with 0 with a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2400720#M62808</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;For the measure you want to truncate, consider another measure that is stopping correctly then&lt;/P&gt;&lt;P&gt;&amp;nbsp;Answer for measure with zeros = IF(ISBLANK([measure that stops correctly]), BLANK, [put the measure here that has the zeros])&lt;/P&gt;&lt;P&gt;It will behave the way you want.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2022 13:18:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2400720#M62808</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-03-17T13:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank with 0 with a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2400732#M62809</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure if I understand your question correctly, but I tried to create a sample pbix file like below.&lt;/P&gt;
&lt;P&gt;I hope the below picture and the attached pbix file help to have some idea to implement it to your model.&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&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;LI-CODE lang="markup"&gt;expected result measure: =
VAR currentdate =
    MAX ( Data[Date] )
VAR mindate =
    CALCULATE ( MIN ( Data[Date] ), FILTER ( ALL ( Data ), Data[Qty] &amp;lt;&amp;gt; 0 ) )
VAR maxdate =
    CALCULATE ( MAX ( Data[Date] ), FILTER ( ALL ( Data ), Data[Qty] &amp;lt;&amp;gt; 0 ) )
RETURN
    IF (
        currentdate &amp;gt;= mindate
            &amp;amp;&amp;amp; currentdate &amp;lt;= maxdate,
        SUM ( Data[Qty] ) + 0,
        BLANK ()
    )
&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 17 Mar 2022 13:24:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2400732#M62809</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-03-17T13:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank with 0 with a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2403147#M62978</link>
      <description>&lt;P&gt;Neither of the answers solved my problem, so I will try to clarify what I need.&lt;BR /&gt;I have a bunch of tables ready to use but the most important ones are: DB, Calendar and Planning.&lt;BR /&gt;The red line in the chart is based on the planned values, the blue one is a count of the DB table.&lt;BR /&gt;In the first chart, the DAX for counting on DB table is: DB COUNT = COUNT(DB[NUMBER]), so if I have a total count of zero in a specific month it appears blank.&lt;BR /&gt;In the second one, the DAX is: DB COUNT = COUNT(DB[NUMBER])+0, but this formula calculates values in the future (we are in march but the chart shows values in april, may and so on).&lt;BR /&gt;I couldn't find a way to replace the blanks values with zeros but just until our current month.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 11:40:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2403147#M62978</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-18T11:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank with 0 with a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2414352#M63715</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could simply add an if condition.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;DB COUNT =&amp;nbsp; &lt;BR /&gt;var _max = maxx(allselected('DB'),[month])&lt;BR /&gt;return&lt;BR /&gt;IF(selectedvalue('calendar'[month])&amp;lt;=_max,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;COUNT(DB[NUMBER])+0, blank())&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;
&lt;P&gt;&lt;SPAN&gt;Jay&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 08:03:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2414352#M63715</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-24T08:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank with 0 with a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2414982#M63763</link>
      <description>&lt;P&gt;It seems a great method but this chart does not show only 2022 values but 2021 values as well. So I think this wouldn't work because it would show 12 as the _max value (because of past years).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 12:19:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2414982#M63763</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-24T12:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank with 0 with a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2416454#M63834</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have date column in DB table?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;DB COUNT =&amp;nbsp;&lt;BR /&gt;var _max = &lt;FONT color="#FF0000"&gt;Format(maxx(allselected('DB'),[date]),"YYYYMM")&lt;/FONT&gt;&lt;BR /&gt;return&lt;BR /&gt;IF(&lt;FONT color="#FF0000"&gt;Format(selectedvalue('calendar'[date]),"YYYYMM")&lt;/FONT&gt;&amp;lt;=_max,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;COUNT(DB[NUMBER])+0, blank())&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;
&lt;P&gt;&lt;SPAN&gt;Jay&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2022 01:38:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2416454#M63834</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-25T01:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank with 0 with a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2417830#M63902</link>
      <description>&lt;P&gt;This solution almost worked but the chart keep showing this blue line and a 0 value on 2022/December instead of ending on 2022/March.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2022 11:56:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2417830#M63902</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-25T11:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank with 0 with a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2417860#M63904</link>
      <description>&lt;P&gt;Add a new column to your date table&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Current month or before = IF( [Date] &amp;lt;= EOMONTH(TODAY(), 0), 1, 0)&lt;/LI-CODE&gt;&lt;P&gt;then create your measure as&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DB Count = IF( SELECTEDVALUE('Date'[Current month or before]) = 1, COALESCE( COUNTROWS(DB),0))&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 25 Mar 2022 12:09:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2417860#M63904</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-03-25T12:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank with 0 with a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2422188#M64214</link>
      <description>&lt;P&gt;It worked just as expected! Thank you so much!!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 17:21:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Replacing-blank-with-0-with-a-condition/m-p/2422188#M64214</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-28T17:21:21Z</dc:date>
    </item>
  </channel>
</rss>

