Open
Description
Bug description
Dataset:
SELECT mcdd.meter_id,
mcdd.bucket,
mcdd.meter_channel_id, mcdd.status,
mcdd.nem12_status,
mcdd.meter_type,
mcdd.channel_type,
mcdd.unit_of_measurement,
mcdd.meter_property_name,
mcdd.customer_name,
mcdd.site_name,
mcdd.physical_time_zone,
mcdd.channel_name,
CASE
WHEN mcdd.channel_type = 'Interval' THEN mcdd.total_value
WHEN mcdd.channel_type = 'Cumulative' THEN
COALESCE(
(mcdd.total_value - COALESCE(
LAG(mcdd.total_value) OVER (PARTITION BY mcdd.meter_id, mcdd.meter_channel_id ORDER BY mcdd.bucket),
0
))::double precision, 0)
ELSE mcdd.total_value
END as calculated_value,
mcdd.average_value,
mcdd.minimum_value,
mcdd.maximum_value
FROM west_Side_place_meter_channel_data_daily as mcdd
JOIN Dashboard_Meter_Type_Channel_Configuration as dmtcc ON dmtcc.channel_name = mcdd.channel_name AND dmtcc.meter_type = mcdd.meter_type AND dmtcc.unit_of_measurement = mcdd.unit_of_measurement
WHERE mcdd.bucket >= '{{ from_dttm }}' at time zone'Australia/Brisbane' AND mcdd.bucket < '{{ to_dttm }}' at time zone'Australia/Brisbane' AND dmtcc.meter_type = 'Electricity';
Filter:
Actual Query:
I don't want to apply date filter two times. There should be only one date filter inside virtual table. How can i achieve that kind of functionality?
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist
- I have searched Superset docs and Slack and didn't find a solution to my problem.
- I have searched the GitHub issue tracker and didn't find a similar bug report.
- I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.