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
FelipeScheihing
Frequent Visitor

Time Intelligence using Measure which returns a Date

Dear all, 

I created a measure that returns a date (Waiting Period Ends); I need to generate another measure that returns the start of the following month respecting Waiting Period Ends.

 

Waiting Period Ends =
if([Hours Month (-4)]>129.999,[Comparison_MaxDate_StartOftMonth(-4)]+59,
        if([Hours Month (-3)]>129.999,[Comparison_MaxDate_StartOftMonth(-3)]+59,
            if([Hours Month (-2)]>129.999,[Comparison_MaxDate_StartOftMonth(-2)]+59,
                if([Hours Month (-1)]>129.999,[Comparison_MaxDate_StartOftMonth(-1)]+59,
                    if([Hours Current Month]>129.999,[Comparison_MaxDate_StartOfCurrentMonth]+59
                )))))
 
I tried to use time intelligence DAX expressions like STARTOFMONTH, and DATEADD, but i failed 
 
 
For example,
if Waiting Period Ends returns 12/14/2022
the new measure should return: 1/1/2023 (first day of the next month)
 
Thank you, I appreciate your time.
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@FelipeScheihing Try:

Measure = 
  VAR __EOM = EOMONTH([Waiting Period Ends],1)
  VAR __Result = DATE(YEAR(__EOM), MONTH(__EOM), 1)
RETURN
  __Result

Also, time intelligence functions are evil. You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@FelipeScheihing Try:

Measure = 
  VAR __EOM = EOMONTH([Waiting Period Ends],1)
  VAR __Result = DATE(YEAR(__EOM), MONTH(__EOM), 1)
RETURN
  __Result

Also, time intelligence functions are evil. You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler, thank you so much! it worked perfectly! I will check the material you shared. 

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.