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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Rigolleto
Resolver I
Resolver I

Calculate total weeks between two dates

Hi,

 

I need some M code in order to calculate the number of weeks between to dates, someone could help me how can I handle this issue, also I was able to handle this using DAX but, I need to calculate the total weeks on Power Query side

 

Thanks

 

 

Capture.PNG

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Rigolleto 

As tested, az38's suggestion is helpful.

Is this problem sloved? 
If it is sloved, could you kindly accept it as a solution to close this case and help the other members find it more quickly?
If not, please let me know.
 
Best Regards
Maggie

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @Rigolleto 

As tested, az38's suggestion is helpful.

Is this problem sloved? 
If it is sloved, could you kindly accept it as a solution to close this case and help the other members find it more quickly?
If not, please let me know.
 
Best Regards
Maggie
az38
Community Champion
Community Champion

Hi @Rigolleto 

I've got no  idea how do you get 5 weeks from 28-days period but try a custom column like

= Number.RoundUp(Number.From(([end day]-[Start day])/7))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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