Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Solved! Go to Solution.
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.
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.
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))
@ghosh_kavitha , 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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
101 | |
86 | |
64 |