cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rsanjuan Member
Member

Display current week time frame

Hi,

 

I have a date table as follows:

 

Date = ADDCOLUMNS(CALENDAR(DATE(2000,1,1),DATE(2025,12,31)),
"DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ),
"Year", YEAR ( [Date] ),
"Monthnumber", FORMAT ( [Date], "MM" ),
"YearMonthnumber", FORMAT ( [Date], "MM YYYY" ),
"YearMonthShort", FORMAT ( [Date], "mmm YYYY" ),
"MonthNameShort", FORMAT ( [Date], "mmm" ),
"MonthNameLong", FORMAT ( [Date], "mmmm" ),
"DayOfWeekNumber", WEEKDAY ( [Date] ),
"DayOfWeek", FORMAT ( [Date], "dddd" ),
"DayOfWeekShort", FORMAT ( [Date], "dddd" ),
"Quarter", "Q" & FORMAT ( [Date], "Q" ),
"YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" )
)

 

I would like to display the current week time frame at the top of my report.  For example, for this week it would be:  March 19 - March 25.  Once it gets to Sunday, it should switch to the next week:  March 26 - April 1.

 

Any idea on how to write the syntax for this?  Thanks!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator v-caliao-msft
Moderator

Re: Display current week time frame

Hi @Rsanjuan,

 

The DAX formula below will work for your requirement.

First create a column in your date table
Weeknumber = WEEKNUM('Date'[Date])

Then create a measure

Measure = FORMAT(LOOKUPVALUE('Date'[Date],'Date'[DayOfWeekNumber],1,'Date'[Weeknumber],WEEKNUM(TODAY()),'Date'[Year],YEAR(TODAY())),"MMMM DD") & " - " & FORMAT(LOOKUPVALUE('Date'[Date],'Date'[DayOfWeekNumber],7,'Date'[Weeknumber],WEEKNUM(TODAY()),'Date'[Year],YEAR(TODAY())),"MMMM DD")

 

Capture.PNG

 

Regards,

Charlie Liao

View solution in original post

2 REPLIES 2
Highlighted
Super User
Super User

Re: Display current week time frame

Hi,

Try this solution and adjust to your needs.

community.powerbi.com/t5/Desktop/Display-this-week-amp-this-month-data/m-p/11207#M2459

Mfelix

Regards

MFelix


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




Moderator v-caliao-msft
Moderator

Re: Display current week time frame

Hi @Rsanjuan,

 

The DAX formula below will work for your requirement.

First create a column in your date table
Weeknumber = WEEKNUM('Date'[Date])

Then create a measure

Measure = FORMAT(LOOKUPVALUE('Date'[Date],'Date'[DayOfWeekNumber],1,'Date'[Weeknumber],WEEKNUM(TODAY()),'Date'[Year],YEAR(TODAY())),"MMMM DD") & " - " & FORMAT(LOOKUPVALUE('Date'[Date],'Date'[DayOfWeekNumber],7,'Date'[Weeknumber],WEEKNUM(TODAY()),'Date'[Year],YEAR(TODAY())),"MMMM DD")

 

Capture.PNG

 

Regards,

Charlie Liao

View solution in original post

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors (Last 30 Days)