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
Anonymous
Not applicable

Count/Sum Days between 2 set of Dates

Hi Everyone, I'm fairly new to Power BI and DAX. But I need my formula from Excel to be in DAX/Power BI within the next few days:

=SUM(DAYS360(A3,F3),-IF(AND(B3<F3,C3<F3),DAYS360(B3,C3),IF(AND(B3<F3,C3>=F3),DAYS360(B3,F3),0)))

 

And here's the sample Tables:

 

yreme_zner_0-1652863809274.png

 

What I basically trying to calculate in PowerBI, for example is Time To Submit, the number of Days Between Open Date and Submit but exclude the days within Hold Start and Hold End in the calculations.

 

Appreciate help on this. Thanks! 

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Thanks for reaching out to us.

You can try this measure

 

Measure = 
var _v1=DATEDIFF(MIN('Table'[Open Date]),MIN('Table'[Submit]),DAY)  //DAYS360(A3,F3)
var _v2=IF(AND(MIN('Table'[Hold Start])<MIN('Table'[Submit]),MIN('Table'[Hold End])<MIN('Table'[Submit])),DATEDIFF(MIN('Table'[Hold Start]),MIN('Table'[Hold End]),DAY),IF(AND(MIN('Table'[Hold Start])<MIN('Table'[Submit]),MIN('Table'[Hold End])>=MIN('Table'[Submit])),DATEDIFF(MIN('Table'[Hold Start]),MIN('Table'[Submit]),DAY),0))  //IF(AND(B3<F3,C3<F3),DAYS360(B3,C3),IF(AND(B3<F3,C3>=F3),DAYS360(B3,F3),0))
return _v1-_v2 

 

result

vxiaotang_0-1653284282923.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Thanks for reaching out to us.

You can try this measure

 

Measure = 
var _v1=DATEDIFF(MIN('Table'[Open Date]),MIN('Table'[Submit]),DAY)  //DAYS360(A3,F3)
var _v2=IF(AND(MIN('Table'[Hold Start])<MIN('Table'[Submit]),MIN('Table'[Hold End])<MIN('Table'[Submit])),DATEDIFF(MIN('Table'[Hold Start]),MIN('Table'[Hold End]),DAY),IF(AND(MIN('Table'[Hold Start])<MIN('Table'[Submit]),MIN('Table'[Hold End])>=MIN('Table'[Submit])),DATEDIFF(MIN('Table'[Hold Start]),MIN('Table'[Submit]),DAY),0))  //IF(AND(B3<F3,C3<F3),DAYS360(B3,C3),IF(AND(B3<F3,C3>=F3),DAYS360(B3,F3),0))
return _v1-_v2 

 

result

vxiaotang_0-1653284282923.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you so much!! 😊

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.