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.
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!
Solved! Go to Solution.
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")
Regards,
Charlie Liao
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")
Regards,
Charlie Liao
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsCovering 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 |
---|---|
108 | |
98 | |
79 | |
67 | |
60 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |