在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 個月前檢視次數 41 次
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 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南