在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
EXPERTO
preguntada hace 5 meses41 visualizaciones
1 Respuesta
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
EXPERTO
respondido hace 5 meses

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas