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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors