I am currently working on a marketing dashboard, where the business user will be able to dynamically aggregate the data daily, weekly and monthly.
I have also added a filter that compares the current timeframe with the previous one such as:
current date vs previous
current week vs previous
current month vs previous
My problem is that when the aggregation is on week or month, the current data might not be complete.
for example if today is Wednesday then at the aggregation my report will compare the previous week with this week until wednesday.
I would like to create a yesno filter that filters on full week/month/quarter.
My idea will be that you can create 2 dynamic measures, one “current” and one “previous”, and several measures to be brought into these 2 dynamic measures depending on the 2 filters selection. These 2 filters will be parameters.
And then you will have the logic like
measure: current_period {
label_from_parameter: metric_selector
type: number
sql:
CASE
WHEN {% parameter period %} = 'week' AND {% parameter completed %} = ‘complete’
THEN ${measure_filtered_for_current_complete_week}
WHEN {% parameter period %} = 'week' AND {% parameter completed %} = ‘not_complete’
THEN ${measure_filtered_for_current_week}
etc etc
END ;;
}