cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Frequent Visitor

## Next date from day of week number

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

1 ACCEPTED SOLUTION
Super User

@Geo_Nelson Sorry, missed a paren:

``````Departure Date =
VAR __Date = MAX('Table'[Process Date])
VAR __DeptDay = MAX('Table'[Route Departure Day]
RETURN
MINX(FILTER(__Table,[WeekdayNum] = __DeptDay),[Date])``````

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
4 REPLIES 4
Community Support

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.

Super User

@Geo_Nelson Try:

``````Departure Date =
VAR __Date = MAX('Table'[Process Date])
VAR __DeptDay = MAX('Table'[Route Departure Day]
RETURN
MINX(FILTER(__Table,[WeekdayNum] = __DeptDay),[Date])``````

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Frequent Visitor

@Greg_Deckler I'm sure I'm doing something wrong on my end.

Super User

@Geo_Nelson Sorry, missed a paren:

``````Departure Date =
VAR __Date = MAX('Table'[Process Date])
VAR __DeptDay = MAX('Table'[Route Departure Day]
RETURN
MINX(FILTER(__Table,[WeekdayNum] = __DeptDay),[Date])``````

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors