How do I exclude weekends from the visuals?

How do I exclude weekends from the visuals? I have tried using conditional formula

isWorkday(date)

which gives me 1 for weekday and 0 for weekend, when I try to use it as a filter for a graph, exclude all 0s, or just include all 1s, it is showing an error.

sourceErrorCode:
CONTEXTUAL_INVALID_ARGUMENT_TYPE

How do I do this correctly?

Hi @kris, try this calculation:

  1. Create a Calculated Field: Create a calculated field that determines whether a date is a weekday or a weekend. You can use a formula like this:
ifelse(
    extract('WD', {date_field}) IN [1, 2, 3, 4, 5], 1, 0
)

This formula extracts the day of the week from your date field, where 1 (Monday) to 5 (Friday) are considered weekdays and returns 1 for weekdays and 0 for weekends.

  1. Add the Calculated Field: Add this calculated field to your dataset.
  2. Filter the Visual: Now, you need to filter your visual to exclude weekends. Go to the analysis view where you have your visual, and apply a filter on the calculated field:
  • Open the Filter pane.
  • Click on + Add and choose the calculated field you created.
  • Set the filter to Equals 1 to include only weekdays.

Also, here is another useful resource:

In case you need further assistance with your problem, please create a sample dashboard with sample dataset showing your problem state using Arena and please create a new post, so we can look at it from a fresh perspective. (Details on using Arena can be found here - QuickSight Arena

Did this solution work for you? I am marking this reply as, “Solution,” but let us know if this is not resolved. Thanks for posting your questions on the QuickSight Community!

1 Like

I have tried “extract” function and it worked. Thank you so much!

1 Like