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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

How to calculate sum of this monday to sunday value - Measure

 
Hi
 How to calculate sum of this week's monday to sunday values & the following week's sum of monday to saunday values.
  ex
this week monday 23/03/2020 to sunday 29/03/2020
following week 30/03/2020 to sunday 05/03/2020  
Thanks in anticipation
Kavitha ghosh
1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous 

There is a problem with the week number method. For the last week of this year is 2020,12,28 - 2021,1,3, the week numbers are different(53 and 1) although they are in the same week. To prevent this problem, I would recommend you to use monday as the flag.

 

In this way, this week would be dates between thismonday and this sunday(monday+6), and next week would be next monday, next sunday(next monday+6).

 

Measure = 
var thismonday=MAXX(FILTER('Table',[Date]<=TODAY()&&WEEKDAY('Table'[Date],2)=1),'Table'[Date])
var nextmonday=MINX(FILTER('Table',[Date]>=TODAY()&&WEEKDAY('Table'[Date],2)=1),'Table'[Date])
Return CALCULATE(SUM('Table'[Value]),DATESBETWEEN('Table'[Date],thismonday,thismonday+6))

 

 

Paul Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@Anonymous 

There is a problem with the week number method. For the last week of this year is 2020,12,28 - 2021,1,3, the week numbers are different(53 and 1) although they are in the same week. To prevent this problem, I would recommend you to use monday as the flag.

 

In this way, this week would be dates between thismonday and this sunday(monday+6), and next week would be next monday, next sunday(next monday+6).

 

Measure = 
var thismonday=MAXX(FILTER('Table',[Date]<=TODAY()&&WEEKDAY('Table'[Date],2)=1),'Table'[Date])
var nextmonday=MINX(FILTER('Table',[Date]>=TODAY()&&WEEKDAY('Table'[Date],2)=1),'Table'[Date])
Return CALCULATE(SUM('Table'[Value]),DATESBETWEEN('Table'[Date],thismonday,thismonday+6))

 

 

Paul Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

RMB
Resolver II
Resolver II

The Weekday and Weeknum functions should be capable of doing this for you.

A quick example below, you would want to add a year check.

WeekTotals =
VAR __ThisWeek = WEEKNUM(TODAY(), 2)
VAR __NextWeek = __ThisWeek + 1

RETURN
CALCULATE(SUM('Table1'[ColumnToSum]), FILTER('Table1', WEEKNUM(T1[Date],2) = __ThisWeek))

 

amitchandak
Super User
Super User

@Anonymous , You can create a date calendar and week start and week end based on that. You can create a week name based on that. Refer, how to so in the calendar and how to use it

 

https://www.dropbox.com/s/a9xq913pgvuzg2x/sales_analytics_weekWiseMon_sun.pbix?dl=0

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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 Kudoed Authors