Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

DAX Date Table - (week start - week end) column

I need to add another column to my DAX date table.  The cloumn needs to have "Week Start Date - Week End Date" and I would like for each date to be formatted as mmm dd.   I have tried, read countle...
  • sturlaws's avatar
    6 years ago

    Hi Anonymous 

     

    try this:

    Column =
    FORMAT ( 'Dim dates'[Date] - WEEKDAY ( 'Dim dates'[Date], 1 ) + 1, "MMM-dd" ) & " - "
        & FORMAT ( 'Dim dates'[Date] + 7 - WEEKDAY ( 'Dim dates'[Date], 1 ), "MMM-dd" )
    

     

     Cheers,
    Sturla 

     



    If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

  • sturlaws's avatar
    sturlaws
    6 years ago

    or do something like this

    weekSort =
    YEAR ( 'Dim dates'[Date] - WEEKDAY ( 'Dim dates'[Date], 1 ) + 1 ) * 100
        + WEEKNUM ( 'Dim dates'[Date] - WEEKDAY ( 'Dim dates'[Date], 1 ) + 1 )