Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

DAX Calendar Pay Periods

I have the following calendar imported into DAX; how can I custom write new columns that indicate pay period number for each specific year?  For example a starting range that can go both forwards and backwards would be  Payperiod Begininning Date = 01/09/2021 and the end of it was 1/22/2021.  How can I write this to where I can have a column that shows the pay period number to side?

 

 

3 Replies

  • AUaero's avatar
    AUaero
    Icon for Responsive Resident rankResponsive Resident

    You could probably figure out a way to do this with DAX, assuming that your pay periods are always two weeks.  I even started trying to figure it out, but then I asked "If I were solving this problem myself, how would I do it?"  Honestly, it's probably faster and easier to either:

    1. Bang out a calendar table inclusive of your pay period column in Excel and then copy the calendar table into your data model, or
    2. Create a table in your data model to define the pay periods and merge it to your existing calendar table in Power Query (assuming your calendar table isn't defined by DAX)
    • Anonymous's avatar
      Anonymous
      Not applicable

      Every two weeks is this what you mean? i.e. a first day would be 12/26/2020 last day would be 1/08/2021