Forum Discussion
Date table addition
Hi Guys,
I have a date table and i want to add a combination of the weeknumber - first day of that week - last day of that week.
I have the columns Date and Weeknum, so this is enough to create the combination above. Someone any idea how to fix this?
Try
Week Start date = DATEADD('Date'[Date],-1*WEEKDAY('Date'[Date])+1,DAY) Week End date = DATEADD('Date'[Date],7-1*WEEKDAY('Date'[Date]),DAY) Week of = format(DATEADD('Date'[Date],-1*WEEKDAY('Date'[Date])+1,DAY),"mm/dd/yy" & " - " & format(DATEADD('Date'[Date],7-1*WEEKDAY('Date'[Date]),DAY),"mm/dd/yy"))Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin
4 Replies
- az38Community Champion
Hi Anonymous
you can use the next statements for calculation:
FirstDayOfWeek = 'Date'[Date] - WEEKDAY('Date'[Date],2)+1and
LastDayOfWeek = 'Date'[Date] - WEEKDAY('Date'[Date],2)+7then use CONCATENATE function https://docs.microsoft.com/en-us/dax/concatenate-function-dax to get any combination you wish in desired format
do not hesitate to give a kudo to useful posts and mark solutions as solution
- AnonymousNot applicableWhat i want: “week1 - 1/1/2020 - 1/7/2020” do i achieve this with your solution?
- amitchandakSuper User
Try
Week Start date = DATEADD('Date'[Date],-1*WEEKDAY('Date'[Date])+1,DAY) Week End date = DATEADD('Date'[Date],7-1*WEEKDAY('Date'[Date]),DAY) Week of = format(DATEADD('Date'[Date],-1*WEEKDAY('Date'[Date])+1,DAY),"mm/dd/yy" & " - " & format(DATEADD('Date'[Date],7-1*WEEKDAY('Date'[Date]),DAY),"mm/dd/yy"))Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin - AnonymousNot applicable
Hi Anonymous ,
Please check the formula below.
Column = var first = CALCULATE(MIN('Date'[Date]),FILTER('Date','Date'[weeknum]=EARLIER('Date'[weeknum]))) var last = CALCULATE(MAX('Date'[Date]),FILTER('Date','Date'[weeknum]=EARLIER('Date'[weeknum]))) return "week"&'Date'[weeknum]&"-"&first&"-"&lastResult would be shown as below.
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.