Date Slice

Hi I need help to have a formula in slice of the data as below.

I need only to show today and yesterday’s data records. but it should be a working day basis.

For example if today = Monday then yesterday = Friday

Appreciate your help

You can do it with SWITCH() and WORKDAY()

Can you give me an example in my case?

I have given now as OR([Date]=Today(),[Date]=Today()-1)

IN(
 [DateColumn],
 LIST(
  TODAY(),
  WORKDAY(TODAY(), -1)
 )
)
2 Likes

Btw, I forgot to ask, they can add records on weekends? If that’s true, on saturday they would be able to see records from saturday and friday, while on sunday they would be able to see records from sunday and friday. I don’t think that’s what you expect

Yes, Its should be Monday and Friday… mostly not on Saturday..

Question is, which records they should be able to see on saturdays and sundays?

they won’t operate in weekends so we can igonre that

And.. what if they do? I mean, we have to think about it.

Previous one works, I’m 99% sure about it, but take this v2:

IN(
  [DateColumn],
  IF(
    OR(
      WEEKDAY(TODAY())=7,
      WEEKDAY(TODAY())=1
    ),
    LIST(
      WORKDAY(TODAY(), -1),
      WORKDAY(TODAY(), -2)
    ),
    LIST(
      TODAY(),
      WORKDAY(TODAY(), -1)
    )
  )
)

Edit: Removed extra “,”

2 Likes

Thanks

1 Like

Having an error in formula

Please share the expression assistant’s error

1 Like

Expression ‘IN( [DateColumn], IF( OR( WEEKDAY(TODAY())=7, WEEKDAY(TODAY())=1, ), LIST( WORKDAY(TODAY(), -1), WORKDAY(TODAY(), -2) ), LIST( TODAY(), WORKDAY(TODAY(), -1) ), ) )’ was unable to be parsed: Sequence contains no elements.

Remove the last “,”

Please check my edited post above

1 Like

same error

IN(
  [DateColumn],
  IF(
    OR(
      WEEKDAY(TODAY())=7,
      WEEKDAY(TODAY())=1
    ),
    LIST(
      WORKDAY(TODAY(),-1),
      WORKDAY(TODAY(),-2)
    ),
    LIST(
      TODAY(),
      WORKDAY(TODAY(), -1)
    )
  )
)
1 Like