Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Need to add a calulated column that returns a date based on day of week number from a given date.
Example:
Process Date (given date): Friday 09/09/22
Route Departure Day (day of week number): 2
Need calulation to return: Monday 09/12/22
thanks, geo
Solved! Go to Solution.
@Geo_Nelson Sorry, missed a paren:
Departure Date =
VAR __Date = MAX('Table'[Process Date])
VAR __DeptDay = MAX('Table'[Route Departure Day]
VAR __Table = ADDCOLUMNS(CALENDAR(__Date,__Date+7),"WeekdayNum",WEEKDAY([Date]) )
RETURN
MINX(FILTER(__Table,[WeekdayNum] = __DeptDay),[Date])
Hi @Geo_Nelson ,
I think you can try this code to create a calculated column.
Next date = 'Table'[Process Date] + 'Table'[Route Departure Day] + 1
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Geo_Nelson Try:
Departure Date =
VAR __Date = MAX('Table'[Process Date])
VAR __DeptDay = MAX('Table'[Route Departure Day]
VAR __Table = ADDCOLUMNS(CALENDAR(__Date,__Date+7),"WeekdayNum",WEEKDAY([Date])
RETURN
MINX(FILTER(__Table,[WeekdayNum] = __DeptDay),[Date])
@Geo_Nelson Sorry, missed a paren:
Departure Date =
VAR __Date = MAX('Table'[Process Date])
VAR __DeptDay = MAX('Table'[Route Departure Day]
VAR __Table = ADDCOLUMNS(CALENDAR(__Date,__Date+7),"WeekdayNum",WEEKDAY([Date]) )
RETURN
MINX(FILTER(__Table,[WeekdayNum] = __DeptDay),[Date])
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
84 | |
77 | |
40 | |
40 | |
35 |