The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Is there a way, similar to WeekNum, but in reverse and convert Calendar Weeks to Dates?
The Calendar week format coming from the data source is 01.2020.
Thanks in advance.
Sure, the basic technique is:
Date Column =
VAR __Year = [Year]
VAR __Week = [WeekNum]
VAR __Calendar =
ADDCOLUMNS(
CALENDAR(DATE(__Year - 1,1,1),DATE(__Year + 1,12,31)),
"__WeekNum",WEEKNUM([Date])
)
RETURN
MINX(FILTER(__Calendar,[__WeekNum] = __Week),[Date])
Thanks, and sorry for the delay in getting back to you. First question, I notice the date column is showing 2019, when it should be 2020.
I had a play with your code and the reason the year is 2019 is because of "-" in the below line, but dont know how to correct.
Does anyoen know why the year is showing 2019, and not the actual year in the column, 2020? Plus, how to change th calendar week begin date from the Tuesday to the Monday?
Anyone?
Found an alternative soultion.
ndate = DATE([year],1,-2)-WEEKDAY(DATE([year],1,3))+[week]*7
Just testing now.
User | Count |
---|---|
80 | |
74 | |
41 | |
30 | |
28 |
User | Count |
---|---|
108 | |
96 | |
53 | |
48 | |
47 |