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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
gsmith_eqd
Frequent Visitor

Next Week Projected Sales

Hello,

I'm trying to create a measure for a report that displays the sum of the sales amount for the following week by filtering based on the shipdate column. There is no error appearing in the formula, but the field is still coming up blank and I can't figure out why.

 

Here's the total sales measure:

 

TotalSales = SUM(SalesOrderLine[Amount])

And here's the measure coming up blank:

 

EstimatedInvoicing =
VAR __ThisDate = TODAY()
VAR __ThisWeek = WEEKNUM(__ThisDate, 1)
VAR __NextWeek = __ThisWeek + 1
VAR __ThisYear = YEAR(__ThisDate)
RETURN

CALCULATE([TotalSales], WEEKNUM(SalesOrderLine[ShipDate]) = __NextWeek && YEAR(SalesOrderLine[ShipDate]) = __ThisYear)


I realize I will probably have to build in an exception for end of year scenarios, but for now _ThisWeek + 1 should be appropriate to give me a populated field. I've tried rephrasing __NextWeek as 'WEEKNUM(__ThisDate, 1) +1' but it didn't make a difference. 

As an experiment I tried writing this without the variables and what I found was interesting.

EstimatedInvoicing TEST =

CALCULATE([TotalSales], WEEKNUM(SalesOrderLine[ShipDate]) = WEEKNUM(TODAY()) + 1 && YEAR(SalesOrderLine[ShipDate]) = YEAR(TODAY()))

 

The measure above gave a blank column. However, when I removed the year filter clause, it was no longer blank. It also wasn't the value I was looking for, but I'm wondering if this is any evidence to help solve this problem.

 

Any help is appreciated!

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @gsmith_eqd 

try first adjust the return type of the 2nd WEEKNUM:

EstimatedInvoicing =

VAR __ThisDate = TODAY()

VAR __ThisWeek = WEEKNUM(__ThisDate, 1)

VAR __NextWeek = __ThisWeek + 1

VAR __ThisYear = YEAR(__ThisDate)

RETURN

 

CALCULATE([TotalSales], WEEKNUM(SalesOrderLine[ShipDate], 1) = __NextWeek && YEAR(SalesOrderLine[ShipDate]) = __ThisYear)

View solution in original post

1 REPLY 1
FreemanZ
Super User
Super User

hi @gsmith_eqd 

try first adjust the return type of the 2nd WEEKNUM:

EstimatedInvoicing =

VAR __ThisDate = TODAY()

VAR __ThisWeek = WEEKNUM(__ThisDate, 1)

VAR __NextWeek = __ThisWeek + 1

VAR __ThisYear = YEAR(__ThisDate)

RETURN

 

CALCULATE([TotalSales], WEEKNUM(SalesOrderLine[ShipDate], 1) = __NextWeek && YEAR(SalesOrderLine[ShipDate]) = __ThisYear)

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.