<?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 DAX to calculate Number of days in a week in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-Number-of-days-in-a-week/m-p/3671776#M142434</link>
    <description>&lt;P&gt;Hi There&lt;/P&gt;&lt;P&gt;How to calculate number of days in a week, like,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attendance Table in which i want to calculate for how many days students are present for that week, Week1,2,3,4,5&lt;/P&gt;&lt;P&gt;in 1st week, how many students are present for 1 day,2days,3days,4 days,5 days&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Feb 2024 02:49:10 GMT</pubDate>
    <dc:creator>Sunilkulkarni</dc:creator>
    <dc:date>2024-02-01T02:49:10Z</dc:date>
    <item>
      <title>DAX to calculate Number of days in a week</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-Number-of-days-in-a-week/m-p/3671776#M142434</link>
      <description>&lt;P&gt;Hi There&lt;/P&gt;&lt;P&gt;How to calculate number of days in a week, like,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attendance Table in which i want to calculate for how many days students are present for that week, Week1,2,3,4,5&lt;/P&gt;&lt;P&gt;in 1st week, how many students are present for 1 day,2days,3days,4 days,5 days&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 02:49:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-Number-of-days-in-a-week/m-p/3671776#M142434</guid>
      <dc:creator>Sunilkulkarni</dc:creator>
      <dc:date>2024-02-01T02:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to calculate Number of days in a week</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-Number-of-days-in-a-week/m-p/3672026#M142447</link>
      <description>&lt;P&gt;To calculate the number of days each student is present in a given week, you can follow these steps using DAX (Data Analysis Expressions) in Power BI or Excel:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;Assuming you have a table named Attendance with columns StudentID, Date, and any other relevant columns.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Create a calculated column to extract the week number from the date. Let's name it WeekNumber.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;WeekNumber = WEEKNUM('Attendance'[Date])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Now, you can create a measure to count the number of days each student is present in each week.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;DaysPresent =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;COUNTROWS('Attendance'),&lt;BR /&gt;FILTER(&lt;BR /&gt;'Attendance',&lt;BR /&gt;'Attendance'[Presence] = "Present" &amp;amp;&amp;amp; 'Attendance'[WeekNumber] = SELECTEDVALUE('Attendance'[WeekNumber])&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;In this measure:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;COUNTROWS('Attendance') counts the number of rows (days) in the attendance table.&lt;/LI&gt;&lt;LI&gt;FILTER('Attendance', 'Attendance'[Presence] = "Present" &amp;amp;&amp;amp; 'Attendance'[WeekNumber] = SELECTEDVALUE('Attendance'[WeekNumber])) filters the attendance table to only count the rows where the student is present and the week number matches the selected week number.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This measure will give you the count of days each student is present in the selected week. You can slice and dice the data by student and week to get the desired analysis. Make sure to replace 'Attendance', 'Presence', and other column names with the actual names from your data model.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 01 Feb 2024 05:31:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-Number-of-days-in-a-week/m-p/3672026#M142447</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2024-02-01T05:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to calculate Number of days in a week</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-Number-of-days-in-a-week/m-p/3672133#M142450</link>
      <description>&lt;P&gt;Thanks for the suggestion, will try this,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im not selecting any week No. but i want to represnt in the Stacked bar chart,&amp;nbsp; below Num are no. of students present&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Week&lt;/TD&gt;&lt;TD&gt;1Day&lt;/TD&gt;&lt;TD&gt;2 Days&lt;/TD&gt;&lt;TD&gt;3 Days&lt;/TD&gt;&lt;TD&gt;4Days&lt;/TD&gt;&lt;TD&gt;5Days&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;45&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Thu, 01 Feb 2024 06:19:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-Number-of-days-in-a-week/m-p/3672133#M142450</guid>
      <dc:creator>Sunilkulkarni</dc:creator>
      <dc:date>2024-02-01T06:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to calculate Number of days in a week</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-Number-of-days-in-a-week/m-p/3675185#M142651</link>
      <description>Hi , can you please reply the DAX</description>
      <pubDate>Fri, 02 Feb 2024 09:29:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-Number-of-days-in-a-week/m-p/3675185#M142651</guid>
      <dc:creator>Sunilkulkarni</dc:creator>
      <dc:date>2024-02-02T09:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to calculate Number of days in a week</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-Number-of-days-in-a-week/m-p/3675209#M142652</link>
      <description>&lt;P&gt;To represent the number of students present for each day of the week in a stacked bar chart in Power BI, you can follow these steps:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Create a New Measure for Each Day:&lt;/STRONG&gt; You need to create a separate measure for each day of the week (1 Day, 2 Days, 3 Days, 4 Days, 5 Days) that calculates the count of students present for that specific number of days.&lt;/P&gt;&lt;P&gt;Here is an example of how you can create a measure for the count of students present for 1 day:&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;StudentsPresent_1Day = CALCULATE(COUNTROWS(Attendance), Attendance[WeekNumber] = SELECTEDVALUE(Attendance[Week]) &amp;amp;&amp;amp; Attendance[DaysPresent] = 1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;You should create similar measures for 2 Days, 3 Days, 4 Days, and 5 Days, replacing the condition Attendance[DaysPresent] = 1 with the appropriate conditions for each measure.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Create a Stacked Bar Chart:&lt;/STRONG&gt; Once you have created the measures for each day, you can create a stacked bar chart with the following settings:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Drag the Week field to the Axis.&lt;/LI&gt;&lt;LI&gt;Drag each measure (StudentsPresent_1Day, StudentsPresent_2Days, etc.) to the Values section of the chart.&lt;/LI&gt;&lt;LI&gt;Ensure that the chart type is set to Stacked Bar Chart.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Format the Chart:&lt;/STRONG&gt; You can format the chart to make it more readable and visually appealing. You may want to adjust the colors, add data labels, and provide a suitable chart title and axis labels.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;By following these steps, you should be able to create a stacked bar chart in Power BI that represents the number of students present for each day of the week across different weeks. Adjust the measures and chart settings based on your specific data structure and requirements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 09:40:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-Number-of-days-in-a-week/m-p/3675209#M142652</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2024-02-02T09:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to calculate Number of days in a week</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-Number-of-days-in-a-week/m-p/3710762#M144372</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="586401" data-lia-user-login="Sunilkulkarni" class="lia-mention lia-mention-user"&gt;Sunilkulkarni&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please &lt;SPAN&gt;try the following methods and check if they can solve your problem:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1.Create the simple table.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2.Using the week num and week day to create the new column.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;weeknumber = WEEKNUM('student present'[Date],2)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;weekday = WEEKDAY('student present'[Date],2)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3.Create the measure to calculate student.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;student present = CALCULATE(
            COUNTROWS('student present'),
            FILTER(
                'student present', 'student present'[IsPresent] = True
            )
        )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;P&gt;&lt;SPAN&gt;4.Drag the week number into the Rows, drag the weekday into the Columns and drag the measure into the matrix visual values.&lt;/SPAN&gt;&lt;/P&gt;
&lt;img /&gt;&lt;/DIV&gt;
&lt;DIV&gt;Best Regards,&lt;/DIV&gt;
&lt;DIV&gt;Wisdom Wu&lt;/DIV&gt;
&lt;DIV&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;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 20 Feb 2024 10:39:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-Number-of-days-in-a-week/m-p/3710762#M144372</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-20T10:39:04Z</dc:date>
    </item>
  </channel>
</rss>

