Filter only on Weekends or Weekdays
- 11-19-2024
Hey pb_si ,
The recommended best practice for retrieving this data is to include a Date Dimension directly in the data model, which is then joined to the relevant Fact tables.
Dim Date includes the Date column along with related columns such as:
- Days_of_week
- Is_weekend or Weekend/Weekday
With this approach, instead of filtering by a specific date, the Weekend/Weekday column can be used as a dashboard filter. This also allows the option to group by this column (see the related screenshot below)
Alternatively, in case Dim_date is not available, the Next Approach is to Create a Custom Column in the data model(Elasticube) or directly in the Source DB With the Weekend/Weekday values.
Here is an example of Custom Column for Elasticubes: case when DayOfWeek(Date) in (1,7) then 'WEEKEND' Else 'WEEKDAY' ENDBest Regards