Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
ChrisAZ
Helper V
Helper V

How to take a date range and give them labels (in this case for pay periods)

Is it possible if we have pay periods that are bi weekly, to create a good way to filter these and select them inside of PowerBI? For example, we have a date range of 1/5 - 1/18, the next one will be 1/19 - 2/1, and it would be great if I could import the data but then have it display as a pay period. Any suggestions?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ChrisAZ,

Thanks for the reply from Sahir_Maharaj.

 

Do you want to assign correct period label for each date based on your bi weekly pay period?

 

If so, here is a simple demo for your reference.

1). Ensure that you have a continuous date table as below:

vqiaqimsftv_0-1737616492516.png

2). Create a calculated column and write the DAX as below:

 

Pay Period = 
VAR StartDate = DATE(2025, 1, 1) -- Define the first pay period start date
VAR PeriodLength = 14 -- Length of a pay period in days
VAR DaysSinceStart = DATEDIFF(StartDate, DateTable[Date], DAY) -- Calculate days since the start date
VAR PeriodNumber = INT(DaysSinceStart / PeriodLength) + 1 -- Determine pay period number
RETURN 
    "Pay Period " & PeriodNumber

 

vqiaqimsftv_1-1737616541296.png

The pbix file is attached.

 

If you have any other questions please feel free to contact me.

 

Best Regards,
Qi

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @ChrisAZ,

Thanks for the reply from Sahir_Maharaj.

 

Do you want to assign correct period label for each date based on your bi weekly pay period?

 

If so, here is a simple demo for your reference.

1). Ensure that you have a continuous date table as below:

vqiaqimsftv_0-1737616492516.png

2). Create a calculated column and write the DAX as below:

 

Pay Period = 
VAR StartDate = DATE(2025, 1, 1) -- Define the first pay period start date
VAR PeriodLength = 14 -- Length of a pay period in days
VAR DaysSinceStart = DATEDIFF(StartDate, DateTable[Date], DAY) -- Calculate days since the start date
VAR PeriodNumber = INT(DaysSinceStart / PeriodLength) + 1 -- Determine pay period number
RETURN 
    "Pay Period " & PeriodNumber

 

vqiaqimsftv_1-1737616541296.png

The pbix file is attached.

 

If you have any other questions please feel free to contact me.

 

Best Regards,
Qi

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

Sahir_Maharaj
Super User
Super User

Hello @ChrisAZ,

 

Can you please try this approach:

Pay Period Label = 
VAR StartDate = DATE(2025, 1, 5)
VAR DaysSinceStart = DATEDIFF(StartDate, 'Sales'[Date], DAY)
VAR PayPeriodNumber = ROUNDUP(DIVIDE(DaysSinceStart, 14), 0)
RETURN "Pay Period " & PayPeriodNumber

 


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

I am not sure if that quite captures what I need. Maybe I should share my pbix? This is not related to Sales. Also, what is it I would be creating?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors