<?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: Why filter function changes values in a column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4663663#M178596</link>
    <description>&lt;P&gt;Try this as a calculated table:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Holidays = DATATABLE("Date",DATETIME,{{"2025-01-01"},{"2025-04-18"},{"2025-04-21"},{"2025-05-05"},{"2025-05-26"},{"2025-08-25"},{"2025-12-25"},{"2025-12-26"}})&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: You had a 2015 date in your sample data.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Apr 2025 17:31:57 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2025-04-22T17:31:57Z</dc:date>
    <item>
      <title>Why filter function changes values in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4663293#M178575</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this DimDate table I created in Power BI Desktop using the Calendar function.&lt;/P&gt;&lt;P&gt;I expanded this table to add a column that counts the number of business/working days per month using the NETWORKDAYS&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;I am trying to enhance my NETWORKDAYS formula by incoporating holidays.&lt;/P&gt;&lt;P&gt;So I tried creating the following variable to bring back a table containing only a list of dates that are declared as holidays using the "IsHoliday" field in my table and then I am passing this in my NETWORKDAYS formula.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var holidays = FILTER(
    DISTINCT(dimDate[date]),
    dimDate[IsHoliday]=1
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I add this variable in my NETWORKDAYS formula so like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;BEFORE:&lt;BR /&gt;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;WorkingDays = 

var lastDateOfMonth = ENDOFMONTH(dimDate[Date])
var startDate = date(dimDate[Year], dimDate[MonthNum], 1)
var endDate = date(dimDate[Year], dimDate[MonthNum], DAY(lastDateOfMonth))

return NETWORKDAYS(startDate,endDate)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;AFTER:&lt;BR /&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;WorkingDays = 

var lastDateOfMonth = ENDOFMONTH(dimDate[Date])
var startDate = date(dimDate[Year], dimDate[MonthNum], 1)
var endDate = date(dimDate[Year], dimDate[MonthNum], DAY(lastDateOfMonth))
var holidays = FILTER(
    DISTINCT(dimDate[date]),
    dimDate[IsHoliday]=1
)

return NETWORKDAYS(startDate,endDate, 1, holidays)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;why does my table change from this:&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;to this:&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;I dont understand why the 23 gets replaced with 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 13:27:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4663293#M178575</guid>
      <dc:creator>mp390988</dc:creator>
      <dc:date>2025-04-22T13:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Why filter function changes values in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4663321#M178576</link>
      <description>&lt;LI-CODE lang="markup"&gt;I have this DimDate table I created in Power BI Desktop using the Calendar function.&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obligatory note:&amp;nbsp; Calendars are immutable. There is no need to compute them over and over again, either in Power Query or in DAX.&amp;nbsp; Yes. it's a rite of passage kind of thing, but it is unnecessary.&amp;nbsp; Use a static external reference table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How did you define the [IsHoliday] column?&amp;nbsp; Usually you have another external reference table that lists the holidays per country, state, county, or city,&amp;nbsp; and you use that table directly in the NETWORKDAYS function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note2:&amp;nbsp; Using NETWORKDAYS in a calculated column is not really necessary (see above), it should really only be used in measures.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 13:51:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4663321#M178576</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2025-04-22T13:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Why filter function changes values in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4663358#M178578</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I am praticing at home so don't have a datawarehouse where I can pick up a dimension table for dates. So I created one manually using DAX but I understand your point, of course if I was working for a company I would use one of their company wide date tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my IsHoliday was created as per below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;IsHoliday = SWITCH(
    TRUE(),
    dimDate[Date] = DATE(2025,1,1), 1,
    dimDate[Date] = DATE(2015,4,18), 1,
    dimDate[Date] = DATE(2025,4,21), 1,
    dimDate[Date] = DATE(2025,5,5), 1,
    dimDate[Date] = DATE(2025,5,26), 1,
    dimDate[Date] = DATE(2025,8,25), 1,
    dimDate[Date] = DATE(2025,12,25), 1,
    dimDate[Date] = DATE(2025,12,26), 1,
    0
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 14:09:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4663358#M178578</guid>
      <dc:creator>mp390988</dc:creator>
      <dc:date>2025-04-22T14:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why filter function changes values in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4663368#M178580</link>
      <description>&lt;P&gt;Trying to debug my code so I thought let me see what the below code returns by creating a table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var holidays = FILTER(
    DISTINCT(dimDate[date]),
    dimDate[IsHoliday]=1
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get this:&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;But when I use it in my WorkingDays formula (defined in my last message) it doesn't complain. Weird&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 14:18:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4663368#M178580</guid>
      <dc:creator>mp390988</dc:creator>
      <dc:date>2025-04-22T14:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: Why filter function changes values in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4663663#M178596</link>
      <description>&lt;P&gt;Try this as a calculated table:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Holidays = DATATABLE("Date",DATETIME,{{"2025-01-01"},{"2025-04-18"},{"2025-04-21"},{"2025-05-05"},{"2025-05-26"},{"2025-08-25"},{"2025-12-25"},{"2025-12-26"}})&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: You had a 2015 date in your sample data.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 17:31:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4663663#M178596</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2025-04-22T17:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Why filter function changes values in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4663999#M178621</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Are there any DAX gurus out there that can explain to me what the below formula does when it gets to the FILTER part? I don't understand how it gets 0 for the WorkingDays when date = 01/01/2025 and I suspect its something to do with the FILTER function part.&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;Thank You&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 22:12:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4663999#M178621</guid>
      <dc:creator>mp390988</dc:creator>
      <dc:date>2025-04-22T22:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Why filter function changes values in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4664492#M178645</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="569801" data-lia-user-login="mp390988" class="lia-mention lia-mention-user"&gt;mp390988&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Try using the all function to remove row context from the dimdate table when filtering holidays. This allows the holiday filter to see the full table rather than just the current row:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;WorkingDays = 

var lastDateOfMonth = ENDOFMONTH(dimDate[Date])
var startDate = date(dimDate[Year], dimDate[MonthNum], 1)
var endDate = date(dimDate[Year], dimDate[MonthNum], DAY(lastDateOfMonth))
var holidays = FILTER(
    ALL(dimDate),
    dimDate[IsHoliday]=1
)

return NETWORKDAYS(startDate,endDate, 1, holidays)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Chaithra.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 07:58:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4664492#M178645</guid>
      <dc:creator>v-echaithra</dc:creator>
      <dc:date>2025-04-23T07:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why filter function changes values in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4664663#M178651</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1250534" data-lia-user-login="v-echaithra" class="lia-mention lia-mention-user"&gt;v-echaithra&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for suggestion, I tried it but has no effect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 09:53:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4664663#M178651</guid>
      <dc:creator>mp390988</dc:creator>
      <dc:date>2025-04-23T09:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why filter function changes values in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4711702#M180451</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="569801" data-lia-user-login="mp390988" class="lia-mention lia-mention-user"&gt;mp390988&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;In a calculated table or as a table expression in a visual, where IsHoliday cannot be resolved to a single value, especially if there's row context but no aggregation or the column is ambiguous across multiple rows. &lt;BR /&gt;This works in your workingdays Formula because you are writing this as a calculated column, meaning DAX evaluates this row by row.&lt;BR /&gt;The formula is calculated for each row of the dimDate table.&lt;BR /&gt;Within each row, dimDate[IsHoliday] has a known value — either 1 or 0.&lt;BR /&gt;So the engine assumes that dimDate[IsHoliday] means at this row, it’s just this one value.&lt;/P&gt;
&lt;P&gt;Even though your holidays variable seems to reference a wider context, it inherits the current row context, which can be misleading. This leads to a subtle bug, FILTER(DISTINCT(dimDate[Date]), dimDate[IsHoliday] = 1) might evaluate to nothing at all, which is why your results may return 0 or unexpected values.&lt;/P&gt;
&lt;P&gt;Fix it by replacing DISTINCT(dimDate[Date]) with ALL(dimDate) or use an external holiday table.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;If this post helps, please give us Kudos and consider marking it Accept as solution to assist other members in finding it more easily.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Chaithra.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2025 08:30:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4711702#M180451</guid>
      <dc:creator>v-echaithra</dc:creator>
      <dc:date>2025-05-29T08:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: Why filter function changes values in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4715937#M180626</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="569801" data-lia-user-login="mp390988" class="lia-mention lia-mention-user"&gt;mp390988&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?&lt;BR /&gt;If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Chaithra.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jun 2025 05:06:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4715937#M180626</guid>
      <dc:creator>v-echaithra</dc:creator>
      <dc:date>2025-06-02T05:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why filter function changes values in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4720217#M180774</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="569801" data-lia-user-login="mp390988" class="lia-mention lia-mention-user"&gt;mp390988&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?&lt;BR /&gt;If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Chaithra.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 18:30:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4720217#M180774</guid>
      <dc:creator>v-echaithra</dc:creator>
      <dc:date>2025-06-04T18:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why filter function changes values in a column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4724912#M180976</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="569801" data-lia-user-login="mp390988" class="lia-mention lia-mention-user"&gt;mp390988&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;We wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?&lt;BR /&gt;If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Chaithra.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jun 2025 05:20:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Why-filter-function-changes-values-in-a-column/m-p/4724912#M180976</guid>
      <dc:creator>v-echaithra</dc:creator>
      <dc:date>2025-06-09T05:20:45Z</dc:date>
    </item>
  </channel>
</rss>

