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
tameismael
Helper I
Helper I

Custom Time Intelligence Function

Dear members,

 

I was trying to write a custom formula to implement the following expressions in many ways but I faced errors each time can you please help me out. The expression is : IF TODAY is > 9/13/2021, then count the # of days from 9/13/2021 to TODAY , then divide that number by 7 in order to get the # of weeks .

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Like this?

 

NumWeeks =
IF (
    TODAY () > DATE ( 2021, 9, 13 ),
    DATEDIFF ( DATE ( 2021, 9, 13 ), TODAY (), DAY ) / 7
)

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

Like this?

 

NumWeeks =
IF (
    TODAY () > DATE ( 2021, 9, 13 ),
    DATEDIFF ( DATE ( 2021, 9, 13 ), TODAY (), DAY ) / 7
)

Thanks indeed Alexis this is exactly what I was targeting I will try it out and hope it gives me the exact results.

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.