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.
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?
Solved! Go to Solution.
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
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&"-"&last
Result 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.
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
Hi @Anonymous
you can use the next statements for calculation:
FirstDayOfWeek = 'Date'[Date] - WEEKDAY('Date'[Date],2)+1
and
LastDayOfWeek = 'Date'[Date] - WEEKDAY('Date'[Date],2)+7
then 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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
82 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |