Keveen-ghori opened a new issue, #31365:
URL: https://github.com/apache/superset/issues/31365
### 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
- [X] I have searched Superset docs and Slack and didn't find a solution to
my problem.
- [X] I have searched the GitHub issue tracker and didn't find a similar bug
report.
- [X] 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]