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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
patri0t82
Post Patron
Post Patron

VALUES function with DATEADD

Hello, can someone please help me adjust this DAX measure? Currently it's collecting all hours within the selected date range, I'd like to use DATEADD to select minus one month

 

YTD Hours Count =
CALCULATE (
SUM ( 'Hours - Tabular'[Value] ),
USERELATIONSHIP ( 'Recordable'[Operating Area], 'Hours - Tabular'[Operating Area] ),
VALUES(CalendarTable[Date])
)
 
I tried 
YTD Hours Count =
CALCULATE (
SUM ( 'Hours - Tabular'[Value] ),
USERELATIONSHIP ( 'Recordable'[Operating Area], 'Hours - Tabular'[Operating Area] ),
VALUES(DATEADD(CalendarTable[Date], -1, MONTH))
)
 
but it didn't like that.
 
Thank you!
1 ACCEPTED SOLUTION
patri0t82
Post Patron
Post Patron

This works!

YTD Hours Count (Last Month) =
CALCULATE(
TOTALYTD (
SUM ( 'Hours - Tabular'[Value] ),
DATEADD( 'CalendarTable'[Date], -1, MONTH)),
USERELATIONSHIP ( 'Recordable'[Operating Area], 'Hours - Tabular'[Operating Area] )
) + 0

View solution in original post

3 REPLIES 3
patri0t82
Post Patron
Post Patron

This works!

YTD Hours Count (Last Month) =
CALCULATE(
TOTALYTD (
SUM ( 'Hours - Tabular'[Value] ),
DATEADD( 'CalendarTable'[Date], -1, MONTH)),
USERELATIONSHIP ( 'Recordable'[Operating Area], 'Hours - Tabular'[Operating Area] )
) + 0
patri0t82
Post Patron
Post Patron

Turns out my solution isn't quite working properly. Can anyone tell me a better way of writing it?

patri0t82
Post Patron
Post Patron

I think I figured it out:

 

YTD Hours Count (Last Month) =
CALCULATE (
SUM ( 'Hours - Tabular'[Value] ),
USERELATIONSHIP ( 'Recordable'[Operating Area], 'Hours - Tabular'[Operating Area] ),
VALUES(CalendarTable[Date]),
DATEADD(CalendarTable[Date],-1,MONTH)
)

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.