Articles in this section
Category / Section

How to get average of data for particular weekday over last 'n' months?

Published:

Calculate Average Data for Weekdays Over Last N Months

This article will guide you on how to calculate the average of data for every weekday over the last 'n' months using Bold BI.​

Steps to Calculate Average Data for Weekdays


1. Calculate the total number of a specific weekday (e.g., Mondays) using a custom query dashboard parameter. Here's a sample query to get the total number of Mondays in the last 3 months:

SELECT COUNT(*) AS total_mondays
FROM generate_series(
    CURRENT_DATE - INTERVAL '3 months',
    CURRENT_DATE,
    INTERVAL '1 day'
) AS dates
WHERE EXTRACT(DOW FROM dates) = 1


2. Use the parameter for the denominator in the division expression, such as `sum([series_count])/[Count of Mondays]`, to calculate the average data for the specific weekday.


Using the above expression, you can get the average of the data based on weekdays (Monday in this case) for the last 3 months.

Related Links
Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
PK
Written by Poovarasan Kandasamy
Updated
Comments (0)
Please  to leave a comment
Access denied
Access denied