Forum Discussion
Anonymous
5 years agoNot applicable
Display data for Monday every week.
Requirement is to display data only for Monday for entire week. Next week, it should again reflect values for Monday this week only. for example : Today is 12th May, Wednesday but report should refl...
- 5 years ago
Hi Anonymous ,
Create 2 columns as below:
Weeknum = WEEKNUM('Table'[Date],2)First Monday = var _mindate=CALCULATE(MIN('Table'[Date]),FILTER('Table','Table'[Weeknum]=EARLIER('Table'[Weeknum]))) var _weekday=WEEKDAY(_mindate,2) Return IF(_weekday<>1,DATE(YEAR(_mindate)-1,12,31-(_weekday-1)+1),_mindate)And you will see:
For the related .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
v-kelly-msft
5 years agoCommunity Support
Hi Anonymous ,
Create 2 columns as below:
Weeknum = WEEKNUM('Table'[Date],2)First Monday =
var _mindate=CALCULATE(MIN('Table'[Date]),FILTER('Table','Table'[Weeknum]=EARLIER('Table'[Weeknum])))
var _weekday=WEEKDAY(_mindate,2)
Return
IF(_weekday<>1,DATE(YEAR(_mindate)-1,12,31-(_weekday-1)+1),_mindate)
And you will see:
For the related .pbix file,pls see attached.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
AppleUSN
2 years agoFrequent Visitor
This solution is flawed. It only works for 1 year because the Weeknum column starts repeating unless you continue to add the year into the week number. Such as 1-52 then 53- 104 as the next week. The solution I used is to have a Week Number and Year to do the filter.
Year-Week = YEAR([Date]) & FORMAT(WEEKNUM([Date], 21), "-\W00")
This creates Year-Week "2023-W39". Then when the first monday is found it is found on the specific week of that specific year. The original formula here was always using the first years week number even when it was 5 years later.