在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
EXPERTE
gefragt vor 5 Monaten41 Aufrufe
1 Antwort
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
EXPERTE
beantwortet vor 5 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen