<?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: Custom Pay Periods in Date Table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Pay-Periods-in-Date-Table/m-p/918194#M8951</link>
    <description>&lt;P&gt;Is there a way to get "Pay period" for every other Saturday? I would like to create a bi-weekly pay period flag using the same logic but it doesnt seems to be working. Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 31 Jan 2020 17:54:47 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-01-31T17:54:47Z</dc:date>
    <item>
      <title>Custom Pay Periods in Date Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Pay-Periods-in-Date-Table/m-p/747354#M2546</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi All,&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to create a custom pay period end date column in my Date table, however, i'm struggling to get it right.&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Basically, if a month has&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;4 Mondays&lt;/STRONG&gt;&lt;SPAN&gt;, then the&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;second Monday&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;will be the1st pay period, and the&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;fourth Monday&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;of that month will be the 2nd pay period.&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the month has&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;5 Mondays&lt;/STRONG&gt;&lt;SPAN&gt;, then the 1st pay period will be&amp;nbsp;the&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;first Monday&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;of the month, the second pay period will be the&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;third Monday&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;of the month, and the 3rd pay period will be the&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;fifth Monday&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;of the month.&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So there will be 3 pay periods if there are 5 Mondays in the month, and 2 pay periods if there are 4 Mondays in the month.&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I found a solution (sort of) on this forum and i tried to play around with it but i can't seem to make it work.&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a link of the&amp;nbsp;&lt;/SPAN&gt;&lt;A title="" href="https://drive.google.com/file/d/1P9ieMW0QkuVDv2V5gwAi_meEfVv0j-Lt/view?usp=sharing" target="_self" rel="nofollow noopener noreferrer"&gt;PBIX&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;file.&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks everyone!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 04:43:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Pay-Periods-in-Date-Table/m-p/747354#M2546</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-24T04:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Pay Periods in Date Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Pay-Periods-in-Date-Table/m-p/747574#M2550</link>
      <description>&lt;PRE&gt;-- I can't access the pbix file due to
-- the company policy. Sorry. But here's
-- something that should get you started...

[Pay Period Number] = -- calculated column
var __currentMonth = Dates[MonthNumber] -- month number 1,2,...,12
var __currentYear = Dates[Year] -- obvious
var __currentDate = Dates[Date]
var __numOfMondaysInMonth =
	COUNTROWS(
		filter(
			Dates,
			Dates[MonthNumber] = __currentMonth
			&amp;amp;&amp;amp; Dates[Year] = __currentYear
			&amp;amp;&amp;amp; Dates[DayName] = "Monday" -- you should have this field in your Dates
		)
	)
var __isMonday = ( Dates[DayName] = "Monday" )
var __whichMonday =
	COUNTROWS(
		filter(
			Dates,
			Dates[MonthNumber] = __currentMonth
			&amp;amp;&amp;amp; Dates[Year] = __currentYear
			&amp;amp;&amp;amp; Dates[DayName] = "Monday"
			&amp;amp;&amp;amp; Dates[Date] &amp;lt;= __currentDate
		)
	)
var __result =
	if (
		__isMonday,
		
		SWITCH( TRUE(),
		
			__numOfMondaysInMonth = 4,
				SWITCH( __whichMonday,
					2, "2nd",
					4, "4th"
				) &amp;amp; " Pay Period",
				
			__numOfMondaysInMonth = 5,
				SWITCH( __whichMonday,
					1, "1st",
					2, "2nd",
					5, "5th"
				) &amp;amp; " Pay Period",
			
			"Check out the calendar for errors."
		)
	)
return
	__result&lt;/PRE&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 08:39:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Pay-Periods-in-Date-Table/m-p/747574#M2550</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-24T08:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Pay Periods in Date Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Pay-Periods-in-Date-Table/m-p/747781#M2569</link>
      <description>&lt;P&gt;THANK YOU SO SO SO MUCH&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;!&lt;BR /&gt;&lt;BR /&gt;This worked perfectly! Just made some few custom changes to make it more specific to my needs but worked like a charm! Appreciate you taking the time to help! Thanks again!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 11:28:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Pay-Periods-in-Date-Table/m-p/747781#M2569</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-24T11:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Pay Periods in Date Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Pay-Periods-in-Date-Table/m-p/918194#M8951</link>
      <description>&lt;P&gt;Is there a way to get "Pay period" for every other Saturday? I would like to create a bi-weekly pay period flag using the same logic but it doesnt seems to be working. Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2020 17:54:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Pay-Periods-in-Date-Table/m-p/918194#M8951</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-01-31T17:54:47Z</dc:date>
    </item>
  </channel>
</rss>

