How to Exclude Specific Week Days from Dashboard Created with PostgreSQL Data Source
When working with date fields in expressions, you may need to exclude specific days of the week (For example, Thursdays and Fridays). This article will guide you on how to exclude specific days from the date field using an expression.
Excluding weekdays from the date field
To exclude Thursdays and Fridays from the date field, you need to convert the date to a character format. Use the following expression to achieve this:
IF(To_Char([DateField], 'Day')!~'(Friday|Thursday)',[DateField],null)
Explanation: The To_Char
function is used to convert the date to a character format, and the IF
function checks if the day is not Thursday or Friday. If the day is not Thursday or Friday, the date is used in the calculation. If the day is Thursday or Friday, the date is replaced with null
.
Example
We have created an expression like below. Except for Thursday and Friday, it calculates the value_count.
Refer to the following image: