Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Current WeekDates

Hi  i would like to know how to write a DAX code that shows  the current week dates    eg. Monday - 01 March 2021 till Sunday 07 March 2021   Thank you 
  • v-robertq-msft's avatar
    5 years ago

    Hi, Anonymous 

    According to your description, I guess that you want to transform your data value in the format as “Monday - 01 March 2021” and place it into a Slicer. I think you can achieve this using a calculated column because measure can not be placed into Slicer in Power BI. you can try this calculate column:

    current week date =
    
    var _weekday=FORMAT([Date],"dddd")
    
    var _daynumber=DAY([Date])
    
    var _month=FORMAT([Date],"mmmm")
    
    var _year=YEAR([Date])
    
    return
    
    _weekday&"-"&_daynumber&" "&_month&" "&_year

    The output of this calculated column is like this:

     

    Then you can create a Slicer and place it into the slicer, like this:

     

    And you can get what you want.

    You can download my test pbix file here

     

    If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

    How to Get Your Question Answered Quickly 

     

    Best Regards,

    Community Support Team _Robert Qin

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.