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! Request now

Reply
Anonymous
Not applicable

Need help with DAX to calculate total number of weeks between two dates

I have a started on date and ended on date (some are blank because they are still active) and I need to count the number of week between start date and end date. Thanks for the help! 

1 ACCEPTED SOLUTION

Hey @Anonymous ,

 

if you use it as calculated column you should not use the MIN and MAX functions.

Try it without:

Age in Weeks = DATEDIFF( fact_member[started_on], fact_member[ended_on] , WEEK )

 

By the way, what should happen if there is no end date? I think this we have to handle somehow.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

3 REPLIES 3
selimovd
Super User
Super User

Hey @Anonymous ,

 

you can do that with the DATEDIFF function:

Weeks between Start and End = DATEDIFF( MIN( myDateTable[StartDate] ), MAX( myDateTable[EndDate] ), WEEK)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 
Anonymous
Not applicable

@selimovd so that looks like it counts them all the same, members who are still active and members who have end dates. See my image. PBI help.png

Hey @Anonymous ,

 

if you use it as calculated column you should not use the MIN and MAX functions.

Try it without:

Age in Weeks = DATEDIFF( fact_member[started_on], fact_member[ended_on] , WEEK )

 

By the way, what should happen if there is no end date? I think this we have to handle somehow.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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