Monthly Cost, Bar Chart- SQL

Hello everyone, I am new on grafana.
I am struggling to deliver to my boss a graph (like a Histogram or a Bar Chart), that shows the monthly cost of last 12 months timeframe.
The problem is that some months , there is no cost, it should return zero.
My basic query is:
SELECT
month(period_start_date) as Mesi,
sum(line_item_cost) AS cost
from CUR_Table
where
user_cliente = ‘MCS’
and
$__timeFilter(bill_billing_period_start_date)
group by 1
order by 1

It returns me one single month, acctualy the current month.

I need it to show me 12 bars, even if some of them is 0.

Could you please help me guys?

Hello,

Is this microsoft sql server or mysql or postgres?

1 Like

Hi Yiosias,
I am using AWS athena. As i found in its documentation: “Athena DML is based on [Presto 0.172]”.
Does this answer your question ?
Many thanks

Dear yosiasz, so many thanks!
It works perfectly!
I am very happy and grateful for such kindness!!
Thank you very much for spending your time to help me. Its amazing.
God bless you!

1 Like