Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
I'm drawing a blank here as to why I'm getting an error.
I'm trying to create a DAX measure that calculates the gross bookings WoW based on dynamic date ranges. The most recent 7 days versus the previous 7 days before it. It works just fine and the measure calculates within Power Pivot with data I've validated.
Sum of BOOKED_ROOMS_WOW:=(CALCULATE(Gross_Bookings[Sum of BOOKED_ROOMS],DATESBETWEEN('Calendar'[Date],LASTDATE(Gross_Bookings[RESERVATION_DATE])-6,LASTDATE(Gross_Bookings[RESERVATION_DATE]))))-(CALCULATE(Gross_Bookings[Sum of BOOKED_ROOMS],DATESBETWEEN('Calendar'[Date],LASTDATE(Gross_Bookings[RESERVATION_DATE])-13,LASTDATE(Gross_Bookings[RESERVATION_DATE])-7)))
When I bring it into a pivot table and try to use it slice this measure with my various dimensions inside the pivot table, some of the dimensions give me an error: mdxscript (model) (6,105) error Calculation error in measure 'Gross_Bookings'[Sum of BOOKED_ROOMS_WOW]: an invalid numeric representation of a date value was encountered. Why? This is killing me...
Maybe rewrite with variables and see if there's any change.
Sum of BOOKED_ROOMS_WOW:=
var ld = LASTDATE(Gross_Bookings[RESERVATION_DATE])
return
CALCULATE(
Gross_Bookings[Sum of BOOKED_ROOMS]
,DATESBETWEEN('Calendar'[Date],ld-6,ld)
)
-
CALCULATE(
Gross_Bookings[Sum of BOOKED_ROOMS]
,DATESBETWEEN('Calendar'[Date],ld-13,ld-7)
)
Didn't work unfortunately. Formula errors.
What's the error message?
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 13 | |
| 9 | |
| 9 | |
| 9 | |
| 8 |