Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Generate Dates

I want to create two measures that would generate the following date range for the current week and previous week. A new week starts on a sunday and ends on a saturday. I want the current week's date range to continue to update as the week increases. so for example, this week's date range as of today would be 08/09/20 - 08/13/20, then tomorrow would show 08/09/20 - 08/14/20 until the week completes etc . Thanks

2 ACCEPTED SOLUTIONS

Please try these two measure expressions

 

Current Week = var thisday = TODAY()
return thisday - WEEKDAY(thisday) +1 & " - " & thisday
 
Previous Week = var thisday = TODAY()
return thisday - WEEKDAY(thisday) -6 & " - " & thisday-WEEKDAY(thisday)
 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

Anonymous
Not applicable

@mahoneypat 

 

 

Thanks for your response but your solution is not clear. I'm not sure what I'm suppose to be looking a but this is what I'm seeing below. Please clarify.

 

 
Current Week = var thisday = TODAY()
return thisday - WEEKDAY(thisday) +1 & " - " & thisday
 
Previous Week = var thisday = TODAY()
return thisday - WEEKDAY(thisday) -6 & " - " & thisday-WEEKDAY(thisday)
 

 

View solution in original post

8 REPLIES 8
amitchandak
Super User
Super User

@Anonymous , not very clear to me .

refer to this post you can generate a calendar that can start on any week day

https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Power-BI-Turning/ba-p/1187482

Anonymous
Not applicable

@amitchandak 

 

Thanks for your response, what i want is simply to find :

1) Current week's start and end date (date range)
2) Previous week's start and end date(date range) 

 

For example, as of today the first measure (current week)  would return  08/09/2020 to 08/13/2020 (continues to update till the end of the current week which would be 08/15/2020

Again, as of today the second measure  for the previous week would return  08/02/2020 to 08/08/2020

 

 

Please try these two measure expressions

 

Current Week = var thisday = TODAY()
return thisday - WEEKDAY(thisday) +1 & " - " & thisday
 
Previous Week = var thisday = TODAY()
return thisday - WEEKDAY(thisday) -6 & " - " & thisday-WEEKDAY(thisday)
 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

@mahoneypat 

 

 

Thanks for your response but your solution is not clear. I'm not sure what I'm suppose to be looking a but this is what I'm seeing below. Please clarify.

 

 
Current Week = var thisday = TODAY()
return thisday - WEEKDAY(thisday) +1 & " - " & thisday
 
Previous Week = var thisday = TODAY()
return thisday - WEEKDAY(thisday) -6 & " - " & thisday-WEEKDAY(thisday)
 

 

You would use these two measures each in their own Card visual, to show in text the week to date and previous week ranges.  I thought that was what you were looking for.  If not, please clarify.

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

@mahoneypat 

Awesome! This is exactly what i want because the Week to date gives the start of the week and current date. Quick question though would this week stop counting on Sat (08/15/2020) since that marks the end of the current week? If yes, then it's perfect and this is exactly waht I want.

Yes.  Here is what it will show on the next few days

Sat - 8/15/2020-8/15/2020

Sun - 8/16/2020-8/16/2020

Mon - 8/16/2020-8/17/2020

 

If that is not correct you can adapt the approach.  If need more help, just reply and @ me.

 

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

@mahoneypat 

 

 

Thanks for the clarification. On Saturday i want it to show Sat - 8/09/2020-8/15/2020 (start and end of the current week) instead not Sat - 8/15/2020-8/15/2020 since that marks the end of the current week, then it stops counting for that week. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.