在Grafana中使用 Athena+CUR, 怎样指定相对时间查询(如上个月)?

0

【以下的问题经过翻译处理】 Stack - 托管Grafana + Athena - 查询 CUR 数据。 目前在我的查询中使用$__timeFilter(line item usage start date)来计算账单数据。 我还想计算前一个月的相同日期之间的花费。 例如,$__timeFilter(line item usage start date)的输出:

select SUM(line_item_blended_cost + discount_total_discount) from yad2_billing_reports where line_item_usage_start_date BETWEEN TIMESTAMP '2022-08-01 14:56:16' AND TIMESTAMP '2022-08-08 14:56:16'

我想要实现:

select SUM(line_item_blended_cost + discount_total_discount) from yad2_billing_reports where line_item_usage_start_date BETWEEN TIMESTAMP '2022-07-01 14:56:16' AND TIMESTAMP '2022-08-08 14:56:16'

profile picture
专家
已提问 5 个月前37 查看次数
1 回答
0

【以下的回答经过翻译处理】 我使用了以下查询语句:

select SUM(line_item_blended_cost + discount_total_discount) as cost from $CUR_Table where line_item_usage_start_date > $__timeFrom() - interval '1' month and line_item_usage_start_date < $__timeTo() - interval '1' month

profile picture
专家
已回答 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则