Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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...
  • mahoneypat's avatar
    mahoneypat
    6 years ago

    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

  • Anonymous's avatar
    Anonymous
    6 years ago

    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)