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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
akhaliq7
Post Prodigy
Post Prodigy

Turn number of days into weeks using power query

I would like to turn number of days into weeks, my days column is a numeric field. I solved this by dividing the number of days by 7 but wanted to know if there was a function in power query for this task. As functions tend to normally have other data preserving measures such as ignoring nulls

1 ACCEPTED SOLUTION
m_dekorte
Super User
Super User

Hi @akhaliq7,

 

The approach you've taken is correct, there is no standard library function in the M language (at this time) to determine the number of weeks based on a number of elapsed days.

For dealing with null values you can include the coalese operator: ?? (a double questionmark) directly following the field reference that could include nulls and supply it an alternative, to illlustrate:

[Num of Days] / 7                 //if  [Num of Days] = null this will return null

[Num of Days]?? 0 / 7         //if  [Num of Days] = null  then 0 this will return 0

 

 

Ps. If this helps solve your query please mark this post as Solution, thanks!

View solution in original post

1 REPLY 1
m_dekorte
Super User
Super User

Hi @akhaliq7,

 

The approach you've taken is correct, there is no standard library function in the M language (at this time) to determine the number of weeks based on a number of elapsed days.

For dealing with null values you can include the coalese operator: ?? (a double questionmark) directly following the field reference that could include nulls and supply it an alternative, to illlustrate:

[Num of Days] / 7                 //if  [Num of Days] = null this will return null

[Num of Days]?? 0 / 7         //if  [Num of Days] = null  then 0 this will return 0

 

 

Ps. If this helps solve your query please mark this post as Solution, thanks!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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 Kudoed Authors