- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Period of days between 2 weeks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-17-2019 10:44 AM
I have found several ranges of dates, but of days I have not found yet, my filter is not a fixed date.
Example: Whenever I look at the report, I need to see last week, the current week and the following week.
I created dimension filter with Weeknum (now ()), Weeknum (now ()) - 1, Weeknum (now ()) + 1.
So I bring the period I need. But within these weeks I need to bring the days of the week, which starts on Friday of the previous week, and ends on the monday of the current week and another that starts at the Wednesday of the last week, and ends on the Thursday of the current week for exemple.
Someone have any idea how can i do it?
Thank a lot of!
Luiz Pereira
Solved! Go to Solution.
Accepted Solutions
Re: Period of days between 2 weeks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-25-2019 01:42 AM
HI @Luiz_Pereira,
You can refer to following steps to achieve your requirement.
Steps:
1. Add WeekNum to original table and create a what if parameter table with index and day of weeks.
= WEEKNUM([Date],1) Calculate table: Selected = SELECTCOLUMNS(GENERATESERIES(1,7,1),"Index",[Value],"Day of Week",FORMAT([Value],"dddd"))
2. Write a measure to check weeknum and selected day of week to display detail information.
Detail = VAR currWeek = MAX ( 'Table 2'[weekNum] ) VAR _weeknow = WEEKNUM ( TODAY (), 1 ) VAR inRange = IF ( MAX ( 'Table 2'[Date] ) IN CALCULATETABLE ( VALUES ( 'Table 2'[Date] ), FILTER ( ALLSELECTED ( 'Table 2' ), 'Table 2'[weekNum] IN { _weeknow - 1, _weeknow, _weeknow + 1 } && YEAR ( 'Table 2'[Date] ) = YEAR ( MAX ( 'Table 2'[Date] ) ) ) ), "Y", BLANK () ) VAR selectedIndex = SELECTEDVALUE ( 'Selected'[Index] ) RETURN IF ( inRange <> BLANK (), CONCATENATEX ( FILTER ( VALUES ( 'Table 2'[Date] ), IF ( currWeek = _weeknow - 1, WEEKDAY ( [Date], 1 ) >= selectedIndex, IF ( currWeek = _weeknow, WEEKDAY ( [Date], 1 ) < selectedIndex ) ) ), FORMAT ( [Date], "dddd" ), "," ) )
3. Create table visual and slicer to show correspondent graph.
Regards,
Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
For learning resources/Release notes, please visit: | |
All Replies
Re: Period of days between 2 weeks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-18-2019 12:58 AM
Hii @Luiz_Pereiram,
>>So I bring the period I need. But within these weeks I need to bring the days of the week, which starts on Friday of the previous week, and ends on the monday of the current week and another that starts at the Wednesday of the last week, and ends on the Thursday of the current week for exemple.
I'm not so clear for your description, can you please explain more about these with expected result?
Regards,
Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
For learning resources/Release notes, please visit: | |
Re: Period of days between 2 weeks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-18-2019 04:44 AM
Hi V-shex-msft thanks for reply!
So, i need to bring 3 weeks, current week, previous week and next week, always.
Example considering our current date.
W2 January (day 6 to 12, week Previous).
W3 January (day 13 to 19, us current week),
W4 January (day 20 to 26, next week)
After that, i need to bring the day range with the day name of de week.
So here theres my problem, because, i need to make some ranges:
Exemple: A filter with start ever on Tuesday of the W2 and ends ever Wednesday of W3.
So if we have this.
W2: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday.
W3: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday.
W4: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday.
The filter need to bring this
W2: Tuesday, Wednesday, Thursday, Friday, Saturday.
W3: Sunday, Monday, Tuesday, Wednesday.
Thanks for helping!
Re: Period of days between 2 weeks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-21-2019 04:09 AM
That's is not possible in Power BI?
Re: Period of days between 2 weeks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-25-2019 01:42 AM
HI @Luiz_Pereira,
You can refer to following steps to achieve your requirement.
Steps:
1. Add WeekNum to original table and create a what if parameter table with index and day of weeks.
= WEEKNUM([Date],1) Calculate table: Selected = SELECTCOLUMNS(GENERATESERIES(1,7,1),"Index",[Value],"Day of Week",FORMAT([Value],"dddd"))
2. Write a measure to check weeknum and selected day of week to display detail information.
Detail = VAR currWeek = MAX ( 'Table 2'[weekNum] ) VAR _weeknow = WEEKNUM ( TODAY (), 1 ) VAR inRange = IF ( MAX ( 'Table 2'[Date] ) IN CALCULATETABLE ( VALUES ( 'Table 2'[Date] ), FILTER ( ALLSELECTED ( 'Table 2' ), 'Table 2'[weekNum] IN { _weeknow - 1, _weeknow, _weeknow + 1 } && YEAR ( 'Table 2'[Date] ) = YEAR ( MAX ( 'Table 2'[Date] ) ) ) ), "Y", BLANK () ) VAR selectedIndex = SELECTEDVALUE ( 'Selected'[Index] ) RETURN IF ( inRange <> BLANK (), CONCATENATEX ( FILTER ( VALUES ( 'Table 2'[Date] ), IF ( currWeek = _weeknow - 1, WEEKDAY ( [Date], 1 ) >= selectedIndex, IF ( currWeek = _weeknow, WEEKDAY ( [Date], 1 ) < selectedIndex ) ) ), FORMAT ( [Date], "dddd" ), "," ) )
3. Create table visual and slicer to show correspondent graph.
Regards,
Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
For learning resources/Release notes, please visit: | |