convert weekday text to date value with enumlist type

chiukim_1-1685407813753.png

I have a column named [week of the day] enumtype list.

I want to get ang actual date value to the selected days of the week. But i want to select to convert text to date is the most recent date from today excluding those expired dates. 
In this example. the day should be converted to date is wednesday = 05/30/2023.

chiukim_2-1685407979931.png

the 2nd example to convert to date should be friday = 06/02/2023

 

 

 

0 4 208
4 REPLIES 4

I don't understand exactly what you're seeking. This partial draft may point you in a helpful direction.

 

{start date} + 
SWITCH(
  INDEX(
    [week of the day]], 
    COUNT(
      [week of the day]]
    )
  ), 
  "Monday", 1
  "Tuesday", 2
  ...
)

 

chiukim_0-1685416703358.png

Hi. here are the expected output for my question. selecting the neariest day from today but greater than today. 

Here's a conceptual description of an approach. You can work through all the syntactical details.

  1. Transform (e.g., using LIST, IFS, and IN) the list of weekday names to a list of corresponding integers. Use the convention that is the premise of the WEEKDAY function (e.g., Monday = 2). If you need Sunday to be the end of the week, maybe assign it 8 (and, then as necessary, account for it as a special case throughout).
  2. Ensure that the list includes exactly once the integer corresponding to today:
    1. Subtract WEEKDAY(TODAY()) from the list.
    2. Add WEEKDAY(TODAY()) to the list.
  3. SORT the list in ascending order.
  4. Convert the list to text and then SPLIT the list at the substring corresponding to today: CONCATENATE(WEEKDAY(), " , ").
  5. Use INDEX to return the second item in the resulting list.
  6. SPLIT that item using its comma delimiter.
  7. Use INDEX to return the first item the resulting list.
  8. That value is the integer that corresponds to the first selected weekday after today. So, subtract WEEKDAY() from that value and add the result to TODAY() to return that weekday's date.

  1. Create an EnumList column called "Weekday" in your table. Add the weekdays as options: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.
  2. Create a virtual column called "DateValue" in the same table.
  3. Set the App formula of the "DateValue" virtual column to the following:
SWITCH(
  TEXT([Weekday]),
  "Monday", TODAY() - WEEKDAY(TODAY()) + 2,
  "Tuesday", TODAY() - WEEKDAY(TODAY()) + 3,
  "Wednesday", TODAY() - WEEKDAY(TODAY()) + 4,
  "Thursday", TODAY() - WEEKDAY(TODAY()) + 5,
  "Friday", TODAY() - WEEKDAY(TODAY()) + 6,
  "Saturday", TODAY() - WEEKDAY(TODAY()) + 7,
  "Sunday", TODAY() - WEEKDAY(TODAY()) + 1,
  ""
)

 

Top Labels in this Space