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
BugmanJ
Helper V
Helper V

Creating Sales Total dependent on date?

Hello There,

 

I have a daily sales Column (lets call it [DATE] and [SALES] which is tied neatly to a date table which has days [DATET], week number [WEEKNUMBER] , month [MONTHNUMBER] etc.

 

Basically what I want to do is say I pick 24th Feburary 2023 (A friday for future readers), how would I construct a measure to calculate how many sales would have occured for that WEEK (Week 😎 and for that MONTH (feburary)

Many thanks

 

B

2 REPLIES 2
bhelou
Responsive Resident
Responsive Resident

HI please try this and see if it works with you : 

Total Sales for Week = CALCULATE(SUM([SALES]), DATESBETWEEN(DateTable[DATET], STARTOFWEEK(SELECTEDVALUE(DateTable[DATET])), ENDOFWEEK(SELECTEDVALUE(DateTable[DATET]))))



This measure uses the DATESBETWEEN function to filter the sales by the week that contains the selected date, as determined by the STARTOFWEEK and ENDOFWEEK functions.



Total Sales for Month = CALCULATE(SUM([SALES]), DATESBETWEEN(DateTable[DATET], STARTOFMONTH(SELECTEDVALUE(DateTable[DATET])), ENDOFMONTH(SELECTEDVALUE(DateTable[DATET]))))




This measure uses the DATESBETWEEN function to filter the sales by the month that contains the selected date, as determined by the STARTOFMONTH and ENDOFMONTH functions.

Thanks but PowerBI says "Failed to resolve name 'STARTOFWEEK', its not a valid table, variable or function name

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors