Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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
Solved! Go to Solution.
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!
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!