<?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 Measure does not ignore the weekend filter, therefore results are empty in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-does-not-ignore-the-weekend-filter-therefore-results/m-p/4340470#M172346</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="15593" data-lia-user-login="Baerbel" class="lia-mention lia-mention-user"&gt;Baerbel&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Based on the description, try using the following DAX formula to calculate employees and onHolidays.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;VAR Employees = 
    CALCULATE(
       SUM(FACT_Parameter[Value]),
       REMOVEFILTERS ( FACT_Parameter[Date] ),
       MONTH ( FACT_Parameter[Date] ) = MONTH( MaxDate ),
       YEAR ( FACT_Parameter[Date] ) = YEAR ( MaxDate ),
       FACT_Parameter[Parameter] = "Employees",
       FACT__Parameter[Value] &amp;gt; 0,
       NOT ( WEEKDAY(FACT_Parameter[Date], 2) IN {6, 7} )
    )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;VAR onHolidays = 
    CALCULATE(
        DISTINCTCOUNT(FACT_Holidays[Emp_ID]),
        FILTER(
            Calender,
            YEAR(Calender[Date]) = MaxYear &amp;amp;&amp;amp;
            MONTH(Calender[Date]) = MaxMonth &amp;amp;&amp;amp;
            WEEKDAY(Calender[Date], 2) &amp;lt; 6 -- Weekdays only
        )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If DAX formula doesn’t work, please provide sample data and visual picture.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Wisdom Wu&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Dec 2024 07:43:31 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-12-23T07:43:31Z</dc:date>
    <item>
      <title>DAX Measure does not ignore the weekend filter, therefore results are empty</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-does-not-ignore-the-weekend-filter-therefore-results/m-p/4338612#M172274</link>
      <description>&lt;P&gt;Dear experts,&lt;BR /&gt;I'm struggling with a DAX-Measure and hope somebody could help me.&lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;&lt;BR /&gt;I want to calculate the share of employees on holiday compared to the total number of employes; my visual is flexible with field parameters for the x-axis, where I would like to display results once per month and once per weekday (but here except suterday and sunday). I have two tables, one with the holidays displayed per day (each single holiday) and a parameter Table, where I have listed the emplyoees as per month. For ability to create a relationship to my calendar tabele I've a date-column here fixed to the last day of the respective month.&lt;BR /&gt;No I have the challenge, that my measure don't show the results for the number of employees, when I'm filtering my visual excluding sutterdays and sundays - I tried to manage it in different ways, but either I can fix this problem but not filter by Department anymore, or the number of employees is not shown for selected month&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;&lt;BR /&gt;Can anybody please help me? &lt;span class="lia-unicode-emoji" title=":face_with_rolling_eyes:"&gt;🙄&lt;/span&gt;The code is attached below&lt;BR /&gt;Thanks so much in advance&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_heart_eyes:"&gt;😍&lt;/span&gt;&lt;BR /&gt;Bärbel&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Share_onholiday = 
VAR MaxYear = YEAR(MAX(Calender[Date]))  
VAR MaxMonth = MONTH(MAX(Calender[Date]))  
VAR MaxDate =
    CALCULATE(
        MAX(Calender[Date]),  
        FILTER(
            Calender,
            YEAR(Calender[Date]) = MaxYear
            MONTH(Calender[Date]) = MaxMonth  
        )
    )
-- number of employees per month in a selected time period even if the [Date] is on a weekend
VAR Employees =
    CALCULATE(
       SUM(FACT_Parameter[Value]),
       REMOVEFILTERS ( FACT_Parameter[Date] ),
       MONTH ( FACT_Parameter[Date] ) MONTH( MaxDate ),
       YEAR ( FACT_Parameter[Date] ) = YEAR ( MaxDate ),
       FACT_Parameter[Parameter] = "Employees",
       FACT__Parameter[Value] &amp;gt; 0 
      )
-- number of employess on holiday
VAR onHolidays =
    CALCULATE(
        DISTINCTCOUNT(FACT_Holidays[Emp_ID]),
        FILTER(
            Calender,
            WEEKDAY(Calender[Date], 2) &amp;lt; 6 &amp;amp;&amp;amp;  
            YEAR(Calender[Date]) = MaxYear &amp;amp;&amp;amp;  
            MONTH(Calender[Date]) = MaxMonth  
        )
    )
VAR Result = DIVIDE(onHolidays, Employees)  
RETURN Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 11:37:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-does-not-ignore-the-weekend-filter-therefore-results/m-p/4338612#M172274</guid>
      <dc:creator>Baerbel</dc:creator>
      <dc:date>2024-12-20T11:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure does not ignore the weekend filter, therefore results are empty</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-does-not-ignore-the-weekend-filter-therefore-results/m-p/4338681#M172279</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="15593" data-lia-user-login="Baerbel" class="lia-mention lia-mention-user"&gt;Baerbel&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can try:&lt;/P&gt;&lt;PRE&gt;Share_onholiday = &lt;BR /&gt;VAR MaxYear = YEAR(MAX(Calender[Date])) &lt;BR /&gt;VAR MaxMonth = MONTH(MAX(Calender[Date])) &lt;BR /&gt;VAR MaxDate =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;MAX(Calender[Date]), &lt;BR /&gt;FILTER(&lt;BR /&gt;Calender,&lt;BR /&gt;YEAR(Calender[Date]) = MaxYear &amp;amp;&amp;amp;&lt;BR /&gt;MONTH(Calender[Date]) = MaxMonth &lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;-- Number of employees per month&lt;BR /&gt;VAR Employees =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM(FACT_Parameter[Value]),&lt;BR /&gt;FACT_Parameter[Parameter] = "Employees",&lt;BR /&gt;FACT_Parameter[Value] &amp;gt; 0,&lt;BR /&gt;YEAR(FACT_Parameter[Date]) = MaxYear,&lt;BR /&gt;MONTH(FACT_Parameter[Date]) = MaxMonth&lt;BR /&gt;)&lt;BR /&gt;-- Number of employees on holiday excluding weekends&lt;BR /&gt;VAR onHolidays =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;DISTINCTCOUNT(FACT_Holidays[Emp_ID]),&lt;BR /&gt;FILTER(&lt;BR /&gt;Calender,&lt;BR /&gt;WEEKDAY(Calender[Date], 2) &amp;lt; 6 &amp;amp;&amp;amp; -- Exclude Saturday (6) and Sunday (7)&lt;BR /&gt;YEAR(Calender[Date]) = MaxYear &amp;amp;&amp;amp; &lt;BR /&gt;MONTH(Calender[Date]) = MaxMonth &lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;VAR Result = DIVIDE(onHolidays, Employees) &lt;BR /&gt;RETURN Result&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>Fri, 20 Dec 2024 12:31:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-does-not-ignore-the-weekend-filter-therefore-results/m-p/4338681#M172279</guid>
      <dc:creator>Kedar_Pande</dc:creator>
      <dc:date>2024-12-20T12:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure does not ignore the weekend filter, therefore results are empty</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-does-not-ignore-the-weekend-filter-therefore-results/m-p/4338692#M172282</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="15593" data-lia-user-login="Baerbel" class="lia-mention lia-mention-user"&gt;Baerbel&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The issue with the measure revolves around filtering holidays correctly while maintaining flexibility to exclude weekends and dynamically aggregate by the selected field parameters for the x-axis (e.g., by month or by weekday). The redundancy in the code stems from the repeated filtering by YEAR(Calendar[Date]) and MONTH(Calendar[Date]), which is unnecessary since MAX(Calendar[Date]) already provides a specific date with these details.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For holidays, the problem arises when excluding weekends like Saturdays and Sundays using WEEKDAY(Calendar[Date]), which conflicts with the ability to filter dynamically by department or by the selected time period. To address this, the measure should ensure that the count of employees on holiday is accurate without losing the ability to apply these filters.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The optimized approach removes the redundant filters for year and month by relying directly on MAX(Calendar[Date]). For the count of employees on holiday, the measure focuses on filtering the Calendar table to exclude weekends using WEEKDAY(Calendar[Date], 2) &amp;lt; 6, ensuring only weekdays are considered. This keeps the calculation consistent and adaptable to changes in the visual's filter context.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The improved measure simplifies the logic while addressing the specific requirement to handle holidays accurately. By removing redundant conditions and ensuring filters are applied only where needed, the measure now dynamically calculates the share of employees on holiday while respecting department filters and the exclusion of weekends. This makes it more efficient and aligned with the intent of the calculation.&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>Fri, 20 Dec 2024 12:41:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-does-not-ignore-the-weekend-filter-therefore-results/m-p/4338692#M172282</guid>
      <dc:creator>DataNinja777</dc:creator>
      <dc:date>2024-12-20T12:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure does not ignore the weekend filter, therefore results are empty</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-does-not-ignore-the-weekend-filter-therefore-results/m-p/4338702#M172284</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="15593" data-lia-user-login="Baerbel" class="lia-mention lia-mention-user"&gt;Baerbel&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;In you var "&lt;STRONG&gt;Holiday"&lt;/STRONG&gt; you mention to calculate Employee count on &lt;STRONG&gt;Weekends&lt;/STRONG&gt; but from your Condition(Weekday(Calender[Date],2)&amp;lt;6) Seems it count Employee on&amp;nbsp;Weekdays.&lt;BR /&gt;&lt;BR /&gt;Can you furthur clarify your requirment and it would be better if you provide some sample data&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 12:48:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-does-not-ignore-the-weekend-filter-therefore-results/m-p/4338702#M172284</guid>
      <dc:creator>Dangar332</dc:creator>
      <dc:date>2024-12-20T12:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure does not ignore the weekend filter, therefore results are empty</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-does-not-ignore-the-weekend-filter-therefore-results/m-p/4338954#M172297</link>
      <description>&lt;P&gt;Dear Danger332,&lt;/P&gt;&lt;P&gt;I'll count weekdays (means excluding Saturday and Sunday)&lt;/P&gt;&lt;P&gt;the problem with my measure arises when applying e.g. for march 2024 - as I excluded in my visual saturdays and sundays it seems to be a problem for the part where I'm calculating the number of employees, as the [date] in the Fact_Parametwr table always refers to EndOfMonth and 31/3/2024 was a Sunday - if I keep saturdays and sundays in my visual it works for the employees part &lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bärbel&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 15:36:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-does-not-ignore-the-weekend-filter-therefore-results/m-p/4338954#M172297</guid>
      <dc:creator>Baerbel</dc:creator>
      <dc:date>2024-12-20T15:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure does not ignore the weekend filter, therefore results are empty</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-does-not-ignore-the-weekend-filter-therefore-results/m-p/4340470#M172346</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="15593" data-lia-user-login="Baerbel" class="lia-mention lia-mention-user"&gt;Baerbel&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Based on the description, try using the following DAX formula to calculate employees and onHolidays.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;VAR Employees = 
    CALCULATE(
       SUM(FACT_Parameter[Value]),
       REMOVEFILTERS ( FACT_Parameter[Date] ),
       MONTH ( FACT_Parameter[Date] ) = MONTH( MaxDate ),
       YEAR ( FACT_Parameter[Date] ) = YEAR ( MaxDate ),
       FACT_Parameter[Parameter] = "Employees",
       FACT__Parameter[Value] &amp;gt; 0,
       NOT ( WEEKDAY(FACT_Parameter[Date], 2) IN {6, 7} )
    )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;VAR onHolidays = 
    CALCULATE(
        DISTINCTCOUNT(FACT_Holidays[Emp_ID]),
        FILTER(
            Calender,
            YEAR(Calender[Date]) = MaxYear &amp;amp;&amp;amp;
            MONTH(Calender[Date]) = MaxMonth &amp;amp;&amp;amp;
            WEEKDAY(Calender[Date], 2) &amp;lt; 6 -- Weekdays only
        )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If DAX formula doesn’t work, please provide sample data and visual picture.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Wisdom Wu&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 07:43:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-does-not-ignore-the-weekend-filter-therefore-results/m-p/4340470#M172346</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-23T07:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure does not ignore the weekend filter, therefore results are empty</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-does-not-ignore-the-weekend-filter-therefore-results/m-p/4342077#M172423</link>
      <description>&lt;P&gt;Dear&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks a lot for the adjusted code and also thanks to&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="568855" data-lia-user-login="Kedar_Pande" class="lia-mention lia-mention-user"&gt;Kedar_Pande&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;both codes are working when I'm evaluating the rwsults as per month as ou can see in table 1. When I'm changing the dimension from month to weekdays (to be able to evaluate the number of employees on holidays per weekday for a period of time -lets say January to December - the results are displayed either for Thuesday (refers to december) - table 3- or when using the months&amp;nbsp; ist shows me only one weekday per month - table 2&lt;BR /&gt;If you have any additional ideas - they are highly welcome - in any case Mery Christmas&lt;/P&gt;&lt;P&gt;Bärbel&lt;BR /&gt;&lt;img /&gt;&lt;img /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Dec 2024 11:30:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-does-not-ignore-the-weekend-filter-therefore-results/m-p/4342077#M172423</guid>
      <dc:creator>Baerbel</dc:creator>
      <dc:date>2024-12-24T11:30:16Z</dc:date>
    </item>
  </channel>
</rss>

